Anybody please elaborate these error:-
void main()
{
int a=5, b=60, func();
printf("\nI am in main-1");
int func(){
printf("\nI am in funct");
return 1;
}
func();
printf("\nI am in main-2");
}
The errors I get are:
- In function 'main':
- Line 8: error: static declaration of 'func' follows non-static declaration
- Line 4: error: previous declaration of 'func' was here
- Line 3: warning: return type of 'main' is not 'int'
I think C allows nested class because the following code is working fine:
void outerfunc()
{
int func()
{
printf("\nI am in funct");
return 1;
}
func();
}
void main()
{
printf("\nI am in main-1");
outerfunc();
printf("\nI am in main-2");
}
void mainARRRRRRRRGGGGGGGGHHHHHHHH!main()returnsintin C.The Definitive C Book Guide and List- stackoverflow.com/questions/562303/…void main(). The C standard doesn't prohibit it.I think C allows nested class because the following code is working fine- Don't think, start reading buddy :-) - stackoverflow.com/questions/2608158/nested-function-in-c