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

a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

0 Answers  


#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }

14 Answers   CDAC, GATE, NDS, TCS,


How do I access command-line arguments?

2 Answers   Bosch, Wipro,


void main() { //char ch; unsigned char ch; clrscr(); for(ch =0;ch<= 127; ch++) printf(" %c= %d \t ", ch, ch); } output?

4 Answers   Groupon,


How many bytes are occupied by near, far and huge pointers (dos)?

0 Answers  






Why doesn't C have nested functions?

2 Answers  


difference between native and cross compilers

0 Answers  


What is the use of ?: Operator?

0 Answers  


what is the output of the following program? #include<stdio.h> void main() { float x=1.1; while(x==1.1) { printf("\n%f",x); x=x-0.1; } }

6 Answers  


What will happen when freeing memory twice

2 Answers  


What is a pragma?

0 Answers  


What is the easiest sorting method to use?

0 Answers  


Categories