Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Variable Number of Arguments
Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(int num, ...); display(4, 12.5, 13.5, 14.5, 44.3); return 0; } void display(int num, ...) { float c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, float); printf("%f", c); } }
Error: invalid va_list declaration
Error: var c data type mismatch
No error
No error and Nothing will print
Show Answer
Correct Answer:
Error: var c data type mismatch
Explanation:
Use
double
instead of
float
in
float c;
← Previous
Next →
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment