Difference between _Bool and bool types in C?
These data types were added in C99. Since bool
wasn't reserved prior to C99, they use the _Bool
keyword (which was reserved).
bool
is an alias for _Bool
if you include stdbool.h
. Basically, including the stdbool.h
header is an indication that your code is OK with the identifier bool
being 'reserved', i.e. that your code won't use it for its own purposes (similarly for the identifiers true
and false
).
There is no difference.
bool
is a macro that expands to _Bool
in stdbool.h
.
And true
is a macro that expands to 1 in stdbool.h