What is the output of this C code?
void foo();
int main()
{
void foo(int);
foo();
return 0;
}
void foo()
{
printf("2 ");
}
Answer: B
Correct answer: Compile time error
Here the two disagree. The declaration in scope says void foo(int), so foo() is called with too few arguments; and the definition, void foo(), conflicts with it as well. Either fault alone is enough for the compiler to reject the program.
Please log in or register to report this question.