Question 3
Back to Exercise
Compiled as C17, why is this program rejected?
#include <stdarg.h>
#include <stdio.h>
int first(...) {
return 0;
}
int main(void) {
printf("%d\n", first(4, 5));
return 0;
}
- A first must return void
- B Before C23 a variadic function needs at least one named parameter before the ellipsis Correct
- C printf cannot call variadic functions
- D There is no bug
Correct Answer: Option B
In C17 va_start needs a named parameter to locate the variable part, so f(...) was not allowed. C23 permits it.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!