What is the output of the following code? void func(void);
What is the output of the following code?
#include <stdio.h>
void func(void);
int main() {
func(10);
return 0;
}
void func(void)
{
printf("Function called\n");
}
Show answerHide answer
Correct answer: (A) Compilation error
Explanation
func is declared as void func(void), so it takes no arguments. Calling func(10) passes an argument, which the compiler rejects as too many arguments.