Zi 字媒體
2017-07-25T20:27:27+00:00
C/C++函數返回1和返回0究竟哪個好?
資料來源: https://mp.weixin.qq.com/s/k665sVh1vaXvEXhWD1iAYQ
https://docs.microsoft.com/zh-tw/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-160
線上編譯器:
https://www.tutorialspoint.com/compile_cpp_online.php
https://www.tutorialspoint.com/compile_c_online.php
標準頭文件裡預先定義好的EXIT_SUCCESS 和EXIT_FAILURE 宏。
常數 定義的值
EXIT_SUCCESS 0
EXIT_FAILURE 1
CODE:
#include
#include
int main()
{
printf("Hello, World!\n");
return EXIT_SUCCESS;//0;
}
#include
#include
using namespace std;
int main()
{
cout << "Hello World" << endl;
return EXIT_SUCCESS;//0;
}
寫了
5860316篇文章,獲得
23313次喜歡