C examples for Language Basics:Variable
C99 introduced a _Bool type to store a Boolean value, which is a value that can only be either 1 (true) or 0 (false).
#include <stdio.h> int main() { _Bool b = 0; /* false value */ }
_Bool is usually accessed via its alias name bool defined by the standard header stdbool.h.
This header also defines the macros true and false as aliases for 1 and 0.
#include <stdbool.h> #include <stdio.h> int main() {/*w w w . j a v a 2 s . com*/ bool b = true; /* true value */ }