main()

{

int i=_l_abc(10);

printf("%d\n",--i);

}

int _l_abc(int i)

{

return(i++);

}

Answers were Sorted based on User's Feedback



main() { int i=_l_abc(10); printf("%d\n",--i); } int ..

Answer / susie

Answer :

9

Explanation:

return(i++) it will first return i and then increments. i.e.
10 will be returned.

Is This Answer Correct ?    7 Yes 1 No

main() { int i=_l_abc(10); printf("%d\n",--i); } int ..

Answer / rahulkulkarni

Post increment - perform operation first , then increment

In function call _l_abc its post increment, so after value 10 to be returned is decided , local variable i is increment , its i in function.

Variable i in _l_abc is different than i in main.

Post decrement : decrement first then perform operation.

In main its pre decrement , returned 10 is decremented to 9, then printed.

Now , unless compiler does not throw error of beginning function name with _ , 9 is printed.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Code Interview Questions

plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............

2 Answers   Wipro,


void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.

2 Answers  


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];

1 Answers  






PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


main() { int i=10; i=!i>14; Printf ("i=%d",i); }

1 Answers  


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,


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

1 Answers  


#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }

0 Answers   Student,


Categories