C++ void return type of main()

后端 未结 8 2398
灰色年华
灰色年华 2020-12-11 01:58

Some C++ compilers allow the main function to have return type void. But doesn\'t the Operating System require int type value returned to specify

8条回答
  •  醉梦人生
    2020-12-11 02:23

    Depending on the compiler, you may be able to use a void main function, however the proper way (that a truly standard compliant compiler should follow) is to return int with 0 being a nice & clean exit and anything else indicating that your program has done something wrong.

提交回复
热议问题