What are the different valid prototypes of 'main' function? [duplicate]

你离开我真会死。 提交于 2020-01-14 14:05:38

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4273507/what-are-the-different-valid-prototypes-of-main-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!