开发者

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

This question already has answers here: 开发者_如何学JAVA Closed 12 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜