5.3.3 Boolean Types

The compiler supports _Bool, a type used for holding true and false values.

The values held by variables of this type are not integers and behave differently in expressions compared to similar expressions involving __bit integer types. Values converted to a _Bool type result in 0 (false) if the value is 0; otherwise, they result in 1 (true). Values converted to an integer __bit type are truncated to the least significant bit.

The <stdbool.h> header defines true and false macros that can be used with _Bool types and the bool macro, which expands to the _Bool type. For example:

#include <stdbool.h>
_Bool motorOn;
motorOn = false;

If you are compiling with the C90 standard, _Bool is not available, but there is a bool type available if you include <stdbool.h>, but which is merely a typedef for unsigned char.