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