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

c program to subtract between two numbers without using '-' sign and subtract function.

1 Answers  


how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.

3 Answers  


What is the significance of scope resolution operator?

0 Answers   Agilent, ZS Associates,


fun(int x) { if(x > 0) fun(x/2); printf("%d", x); } above function is called as: fun(10); what will it print? }

17 Answers   NDS,


what different between c and c++

1 Answers  






What is the purpose of macro in C language?

0 Answers   Fidelity,


can we declare a variable in different scopes with different data types? answer in detail

3 Answers   TCS,


What is the difference between printf and scanf )?

0 Answers  


in b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first a) 6.6/a b) 2*a c) 3*c d) 2/n

1 Answers  


What's the best way to declare and define global variables?

7 Answers  


what r the cpu registers r ther?

1 Answers  


What is use of bit field?

0 Answers  


Categories