What is the output of this C code?
double foo();
int main()
{
foo();
return 0;
}
foo()
{
printf("2 ");
return 2;
}
Answer: B
Correct answer: Compile time error
The prototype declares double foo(), but the definition omits the return type and so defaults to int. The two conflict, and the compiler rejects the program.
Please log in or register to report this question.