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

Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

0 Answers  


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,






struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }

1 Answers  


1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 Answers  


#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer

1 Answers  


Printf can be implemented by using __________ list.

3 Answers  


what is the code of the output of print the 10 fibonacci number series

2 Answers  


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"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


Categories