C examples for stdbool.h:bool
macro
C99 adds the header <stdbool.h>, which supports the _Bool data type.
The reason that C99 used _Bool rather than bool is that many existing C programs had already defined their own custom versions of bool.
By defining the Boolean type as _Bool , C99 avoids breaking this preexisting code.
Macro | Expands To |
---|---|
bool | _Bool |
true | 1 |
false | 0 |
__bool_true_false_are_defined | 1 |
#include <stdio.h> #include <stdbool.h> int main()//from w w w .j a v a2 s. c o m { printf("Hello World\n"); bool b = true; printf("%d",b); return 0; }