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

Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

0 Answers  


What is the translation phases used in c language?

0 Answers  


Why can’t we compare structures?

0 Answers  


int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain me output????

1 Answers  






Describe wild pointers in c?

0 Answers  


what is the other ways to find a logic to print whether a number is an even or odd wit out using % symbol??????? i know three different ways to print it. so i need any other different logic>>>>>

5 Answers   TCS,


main() { float a=8.8; double b=8.8; if(a==b) printf("Equal"); else printf("not equal"); getch(); } what is the output? with reason

6 Answers   CSC,


Difference between Function to pointer and pointer to function

0 Answers  


Where we use clrscr in c?

0 Answers  


how can i get this by using for loop? * ** * **** * ******

3 Answers   Excel,


What is ## preprocessor operator in c?

0 Answers  


Categories