f()
{
int a=2;
f1(a++);
}
f1(int c)
{
printf("%d", c);
}
c=?

Answers were Sorted based on User's Feedback



f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / vignesh1988i

c=2

Is This Answer Correct ?    16 Yes 0 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / jack

in line 4, a's value is pushed on to stack and then
increaments.........In line 6 the function f1 pops the a's
value and assigned to c so .......c is value is 2.......

Is This Answer Correct ?    7 Yes 2 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / viji

a++ is postfix operator so it first assigns its values and
then incremented. In above statement the value of a is first
assigned to c and then increment. so the output of c is 2;

Is This Answer Correct ?    1 Yes 0 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / raj

f1 should have a prototype

Is This Answer Correct ?    1 Yes 0 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / xx

no output

Is This Answer Correct ?    1 Yes 0 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / jasna.c

no output

Is This Answer Correct ?    2 Yes 2 No

f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? ..

Answer / banavathvishnu

a value will be first assigned to C in the Function and
latter it will be incremented in f() function.
so the value C remains 2

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Is flag a keyword in c?

0 Answers  


What is indirect recursion? give an example?

4 Answers  


When should a type cast be used?

0 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

2 Answers  


what is array?

8 Answers  


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

1 Answers   CMS,


What is the difference b/w main() in C language and main() in C++.

7 Answers  


main() {int i=5; // line 1 i=(++i)/(i++); // line 2 printf("%d",i); // line 3 } output is 2 but if we replace line 2 and line 3 by printf("%d",i=(++i)/(i++)); then output is 1. Why?

1 Answers   GATE,


What are the different types of errors?

0 Answers  


What is structure packing in c?

0 Answers  


what is the output for the code : main() { int i,j; printf("%d %d ",scanf("%d%d",&i,&j)); }

20 Answers   Infosys,


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


Categories