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

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.

This question is related to c boolean

The answer is


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.


More accurately anything that is not 0 is true.

So 1 is true, but so is 2, 3 ... etc.