In c, in bool, true == 1 and false == 0?

前端 未结 2 1604
醉梦人生
醉梦人生 2021-02-14 19:07

Just to clarify I found similar answer but for C++, I\'m kinda new to coding so I\'m not sure whether it applies to C as well.

2条回答
  •  渐次进展
    2021-02-14 19:54

    You neglected to say which version of C you are concerned about. Let's assume it's this one:

    http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

    As you can see by reading the specification, the standard definitions of true and false are 1 and 0, yes.

    If your question is about a different version of C, or about non-standard definitions for true and false, then ask a more specific question.

提交回复
热议问题