久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么C和C++中main函數的類型留給用戶定義?

Why is the type of the main function in C and c++ left to the user to define?(為什么C和C++中main函數的類型留給用戶定義?)
本文介紹了為什么C和C++中main函數的類型留給用戶定義?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

為什么 main() 是用戶定義的函數?

Why is main() a user defined function ?

我什么時候使用 void main()int main()?

When will I use void main() and int main()?

推薦答案

EDIT 這個答案并不完整,因為它沒有真正解決奇怪的句子或其他實現定義的方式".我現在寫了一個更完整的答案它還解決了 C90、C11 和 C++.編輯結束

EDIT This answer is not as complete as it could be since it doesn't really address the strange sentence "or otherwise in some implementation-defined manner". I have now written a more complete answer which also addresses C90, C11 and C++. END OF EDIT

以下是 C 標準的說明(ISO C 9899:1999):

Here is what the C standard says (ISO C 9899:1999):

5.1.2.1 獨立環境

5.1.2.1 Freestanding environment

在一個獨立的環境中(在其中 C程序執行可能發生沒有任何經營利益系統),名稱和類型程序啟動時調用的函數是實現定義./../效果程序終止在一個獨立的環境是實現定義.

In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined. / .. / The effect of program termination in a freestanding environment is implementation-defined.

5.1.2.2 托管環境

5.1.2.2 Hosted environment

不需要提供托管環境,但是應符合以下規格(如果有).

A hosted environment need not be provided, but shall conform to the following specifications if present.

5.1.2.2.1 程序啟動

5.1.2.2.1 Program startup

程序啟動時調用的函數名為主要的.實現聲明沒有這個函數的原型.它應用 int 返回類型定義并且沒有參數:

The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters:

int main(void) {/* ... *

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉換為 HSV 并將 HSV 轉換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉換為字符串?)
When to use inline function and when not to use it?(什么時候使用內聯函數,什么時候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關嗎?)
主站蜘蛛池模板: 99精品久久久国产一区二区三 | 日韩a在线 | 国产精品不卡 | 97日韩精品 | 亚洲精品久久久久久一区二区 | 国产精品国产三级国产a | 成人免费影院 | 国产视频h | 中国三级黄色录像 | 中文字幕国产 | 男人天堂99 | 久久在线视频 | 日本黄色一级视频 | 亚洲午夜精品一区二区三区他趣 | 国产成人叼嘿视频在线观看 | av网站在线免费观看 | 久久成人一区 | 亚洲人的av| 国产aⅴ爽av久久久久久久 | www.夜夜骑 | 一二区成人影院电影网 | 久久久久久国产精品 | 久久不射电影网 | 亚洲成人一区二区 | 狠狠爱视频 | 亚洲视频免费在线 | 国产视频2021 | 亚洲精品一区二区三区在线 | 红色av社区 | 久久99精品久久久97夜夜嗨 | 一区二区三区在线观看视频 | 亚洲成人精品久久久 | 91精品国产91久久久久久三级 | 天天人人精品 | 亚洲欧美日韩精品久久亚洲区 | 欧美三级电影在线播放 | 国产精彩视频一区 | www精品美女久久久tv | 日本三级电影免费观看 | 无人区国产成人久久三区 | 日韩精品在线一区 |