main( )

{

int a[ ] = {10,20,30,40,50},j,*p;

for(j=0; j<5; j++)

{

printf(“%d” ,*a);

a++;

}

p = a;

for(j=0; j<5; j++)

{

printf(“%d ” ,*p);

p++;

}

}



main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) ..

Answer / susie

Answer :

Compiler error: lvalue required.

Explanation:

Error is in line with statement a++. The operand must be an
lvalue and may be of any of scalar type for the any
operator, array name only when subscripted is an lvalue.
Simply array name is a non-modifiable lvalue.

Is This Answer Correct ?    9 Yes 1 No

Post New Answer

More C Code Interview Questions

main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,


void pascal f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } void cdecl f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }

1 Answers  


How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  


main() { 41printf("%p",main); }8

1 Answers  






main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }

1 Answers   DCE,


Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

2 Answers   Ace Info,


how to check whether a linked list is circular.

11 Answers   Microsoft,


what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


Categories