Why main does not return 0 here?

前端 未结 3 1120
陌清茗
陌清茗 2020-12-13 05:09

I was just reading

ISO/IEC 9899:201x Committee Draft — April 12, 2011

in which i found under 5.1.2.2.3 Program termination



        
3条回答
  •  悲哀的现实
    2020-12-13 05:59

    That rule was added in the 1999 version of the C standard. In C90, the status returned is undefined.

    You can enable it by passing -std=c99 to gcc.

    As a side note, interestingly 9 is returned because it's the return of printf which just wrote 9 characters.

提交回复
热议问题