Discussion :: C-MCQs
-
What is the output of this C code?
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf("2 ");
}
Answer : Option D
Explanation :
Even though the answer is 2, this code will compile fine only with gcc. GNU C supports nesting of functions in C as a language extension where as standard C compiler doesn't.
Be The First To Comment