|
C Programming Reference >> C Programming Reference Question Bank >> 19/07/07 - 364 Views - No Ratings Yet Level - Advance Question - Determine the output of the following program.
Answer - 5 Explanation - This is a specially difficult C program which based on some of the most rarely used topic variable argument functions. These functions are very powerfull and basic example of them is scanf and printf. Also you need to include header <stdarg.h> for variable argument functions. Here ripple is our variable argument. va_list type variable 'p' is a special type of variable capable of storing a variable of any type. va_start puts the first variable n in the va_list variable 'p' ie. int value 3.Now when va_arg (p,int) is called it puts value of next variable in 'p' and returns its value 5 in i.Next i just puts the value 5 into k in a complicated manner and this value is returned. So the ouput obtained is 5. This question may be hard to grasp and read again if needed, also try an experiment with code for better understanding. Reader Comments -
|
|||