C Programming - Variable Number of Arguments - Discussion

Discussion Forum : Variable Number of Arguments - Point Out Errors (Q.No. 7)
7.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
void varfun(int n, ...);

int main()
{
    varfun(3, 7, -11.2, 0.66);
    return 0;
}
void varfun(int n, ...)
{
    float *ptr;
    int num;
    va_start(ptr, n);
    num = va_arg(ptr, int);
    printf("%d", num);
}
Error: too many parameters
Error: invalid access to list member
Error: ptr must be type of va_list
No error
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
16 comments Page 2 of 2.

Bond said:   1 decade ago
Is there any one who can explain it ?

Sunil kumar yadav said:   1 decade ago
Kindly explain in briefly?

Prem said:   1 decade ago
Please kindly explain in brief.

Rajan said:   1 decade ago
Sir please explain the answer of this question.

Rujuta kelkar said:   1 decade ago
PlZ explain. Its kinda difficult to understand. We need more explanation.

Riz said:   1 decade ago
Can anyone explain?


Post your comments here:

Your comments will be displayed after verification.