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

union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

3 Answers   HCL,


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

1 Answers  


Find the largest number in a binary tree

7 Answers   Infosys,






Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


main() { printf("%d", out); } int out=100;

3 Answers  


main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

1 Answers  


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

9 Answers   CSC, GoDB Tech, IBM,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


Categories