What are the different valid prototypes of 'main' function? [duplicate]
Possible Duplicate:
What are the valid signatures for C's main() function?
What are the different valid prototypes of 'main' function?
Are there some non-standard prototypes also supported only by a few vendors?
The C standard (§ 5.1.2.2.1) defines two entry point prototypes:
int main(void);
or
int main(int argc, char **argv);
Other than that, every OS has its own additional non-standard entry points. WinMain, etc.
The full prototype allowed by gcc is:
int main(int argc, char * argv[], char *envp[])
but envp
is rarely used. Omitting argc
and argv
is also considered acceptable.
精彩评论