4.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 integer types. Values converted to a _Bool
type result in 0 (false)
if the value is 0; otherwise, they result in 1 (true).
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;