Why does int main() {} compile?

后端 未结 4 859
时光取名叫无心
时光取名叫无心 2020-12-02 22:32

(I\'m using Visual C++ 2008) I\'ve always heard that main() is required to return an integer, but here I didn\'t put in return 0; and and it compiled w

4条回答
  •  囚心锁ツ
    2020-12-02 23:13

    This is part of the C++ language standard. An implicit return 0 is generated for you if there's no explicit return statement in main.

提交回复
热议问题