Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: C 的 main() 函数的有效签名是什么?
'main' 函数有哪些不同的有效原型?
是否有一些非标准原型也只有少数供应商支持?
C 标准(第 5.1.2.2.1 节)定义了两个入口点原型:
int main(void);
或者
int main(int argc, char **argv);
除此之外,每个操作系统都有自己额外的非标准入口点。WinMain 等
gcc 允许的完整原型是:
int main(int argc, char * argv[], char *envp[])
但envp很少使用。省略argc并且argv也被认为是可以接受的。
envp
argc
argv