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

1. What is the output of printf("%d") 2. What will happen if I say delete this 3. Difference between "C structure" and "C++ structure". 4. Diffrence between a "assignment operator" and a "copy constructor" 5. What is the difference between "overloading" and "overridding"? 6. Explain the need for "Virtual Destructor". 7. Can we have "Virtual Constructors"? 8. What are the different types of polymorphism? 9. What are Virtual Functions? How to implement virtual functions in "C" 10. What are the different types of Storage classes? 11. What is Namespace? 12. What are the types of STL containers?. 13. Difference between "vector" and "array"? 14. How to write a program such that it will delete itself after exectution? 15. Can we generate a C++ source code from the binary file? 16. What are inline functions? 17. Talk sometiming about profiling? 18. How many lines of code you have written for a single program? 19. What is "strstream" ? 20. How to write Multithreaded applications using C++? 21. Explain "passing by value", "passing by pointer" and "passing by reference" 22. Write any small program that will compile in "C" but not in "C++" 23. Have you heard of "mutable" keyword? 24. What is a "RTTI"? 25. Is there something that I can do in C and not in C++? 26. Why preincrement operator is faster than postincrement? 27. What is the difference between "calloc" and "malloc"? 28. What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"? 29. What is Memory Alignment? 30. Explain working of printf. 31. Difference between "printf" and "sprintf". 32. What is "map" in STL? 33. When shall I use Multiple Inheritance? 34. What are the techniques you use for debugging? 35. How to reduce a final size of executable? 36. Give 2 examples of a code optimization.

2 Answers  


write a c program to find the roots of a quadratic equation ax2 + bx + c = 0

11 Answers   CSC, St Marys, TATA,


diff between exptected result and requirement?

0 Answers   HCL,


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

0 Answers  






What is 1d array in c?

0 Answers  


explain what are actual arguments?

0 Answers  


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

0 Answers   TCS,


Why are all header files not declared in every c program?

0 Answers  


i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }

2 Answers  


write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer

1 Answers  


In C language, a variable name cannot contain?

0 Answers  


Categories