Variable Number of Arguments

Q1:
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
void display(char *s, ...);
void show(char *t, ...);

int main()
{
    display('Hello', 4, 12, 13, 14, 44);
    return 0;
}
void display(char *s, ...)
{
    show(s, ...);
}
void show(char *t, ...)
{
    int a;
    va_list ptr;
    va_start(ptr, s);
    a = va_arg(ptr, int);
    printf('%f', a);
}

A Error: invalid function display() call

B Error: invalid function show() call

C No error

D Error: Rvalue required for t

ANS:A - Error: invalid function display() call

The call to show() is improper. This is not the way to pass variable argument list to a function.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.