Question
What is the output of this C code?
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf("2 ");
}
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf("2 ");
}
Answer: Option D
Was this answer helpful ?
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.
Was this answer helpful ?
More Questions on This Topic :
Question 4. Which of following is not accepted in C? ....
Question 8. The scope of an automatic variable is: ....
Question 10. Which of the following is a storage specifier? ....
Submit Solution