What will be the output of the following C code?
#include <stdio.h>
#include <stdarg.h>
int f(int c, ...);
int main()
{
int c = 97;
float d = 98;
f(c, d);
return 0;
}
int f(int c, ...)
{
va_list li;
va_start(li, c);
float d = va_arg(li, float);
printf("%f\n", d);
va_end(li);
}
#include <stdio.h>
#include <stdarg.h>
int f(int c, ...);
int main()
{
int c = 97;
float d = 98;
f(c, d);
return 0;
}
int f(int c, ...)
{
va_list li;
va_start(li, c);
float d = va_arg(li, float);
printf("%f\n", d);
va_end(li);
}A. Compile time error
B. Undefined behaviour
C. 97.000000
D. 98.000000
Answer: Option B

Join The Discussion