Why does int main() {} compile?

后端 未结 4 850
时光取名叫无心
时光取名叫无心 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:14

    I'm pretty sure VC++ just inserts a return 0 if you don't include one in main functions. The same thing can happen with functions too, but in those cases at least you'll get a warning.

提交回复
热议问题