本文介紹了C/C++ 中 void main 和 int main 的區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
在 C++(或 C)程序中聲明 main
函數的方式有關系嗎?
Does it matter which way I declare the main
function in a C++ (or C) program?
推薦答案
區別在于一個是正確定義main
的方式,另一個不是.
The difference is one is the correct way to define main
, and the other is not.
是的,這很重要.要么
int main(int argc, char** argv)
或
int main()
是根據 C++ 規范對 main
的正確定義.
are the proper definition of your main
per the C++ spec.
void main(int argc, char** argv)
現在不是,也曾經是 IIRC,它是舊版 Microsoft 的 C++ 編譯器帶來的反常現象.
is not and was, IIRC, a perversity that came with older Microsoft's C++ compilers.
https://isocpp.org/wiki/faq/newbie#main-返回-int
這篇關于C/C++ 中 void main 和 int main 的區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!