Search code examples
cbooleanc99

_Bool data type of C99


The C99 standard of the C programming language defines the _Bool data type as a macro for another data type (as the language isn't able to deal with a type safe boolean).

Is the _Bool a macro for unsigned char, unsigned int or some other data type?


Solution

  • _Bool is a separate integer type that according to the C Standard. _Bool is a keyword of the C language.

    2 An object declared as type _Bool is large enough to store the values 0 and 1.

    _Bool is unsigned integer type.

    The type _Bool and the unsigned integer types that correspond to the standard signed integer types are the standard unsigned integer types.

    And there should be mentioned that

    — The rank of _Bool shall be less than the rank of all other standard integer types.