开发者

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

开发者 https://www.devze.com 2023-01-27 08:46 出处:网络
This question already has answers here: 开发者_如何学JAVAClosed 12 years ago. Possible 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

精彩评论

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