stdbool.h is a new
header file introduced in the
C99 revision of the
ANSI/
ISO C specification. Because C doesn't have a
boolean type, programmers were forever defining one, along with
constants for true and false. This header file finally provides a standard way of doing this.
It defines three macros:
- bool which can be used as a type to hold boolean data
- true, numerically equivalent to 1 and can be stored in variables of bool
- false, numerically equivalent to 0 and can be stored in variables of bool
It is worth noting that these macros are source compatible with the C++ bool type, which may make moving between the languages easier.