Why does the following code show an error?
问题 #include <stdio.h> void m(); void n() { m(); } void main() { void m() { printf("hi"); } } On compiling, an error "undefined reference to m" is shown. Which m is being referred to? 回答1: First, let me declare clearly, Nested functions are not standard C. They are supported as GCC extension. OK, now, in your code, m() is a nested function inside main() . It is having block scope for main() only. Outside main() other functions cannot see the existence of m() ,neither can call m() directly. m()