main()在C和C++中定义函数的正确(最有效)方法是什么- int main()或void main()- 为什么?如果int main()那么return 1或return 0?
这个问题有很多重复,包括:
main()函数的有效签名是什么?main()函数void main()和int main()?main()在C++中的签名main()? - 对于C++,确实有一个非常好的答案.main()C语言中的函数样式main()C中的方法类型int main()vs void main()在C中有关:
What is the proper signature of the main function in C++? What is the correct return type, and what does it mean to return a value from main? What are the allowed parameter types, and what are their meanings?
这是系统特定的吗?这些规则会随着时间而改变吗?如果我违反它们会发生什么?