What are the different valid prototypes of 'ma

2020-04-12 03:25发布

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?

标签: c main
2条回答
劫难
2楼-- · 2020-04-12 04:09

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.

查看更多
再贱就再见
3楼-- · 2020-04-12 04:13

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.

查看更多
登录 后发表回答