| |||
| Home > Compiler Coding Practices > Boolean type and <stdbool.h> in C99 | |||
C99 introduces the native type _Bool. The associated
standard header <stdbool.h> introduces the macros bool, true and false for
Boolean tests. For example:
#include <stdbool.h>
bool foo(FILE *str)
{
bool err = false;
...
if (!fflush(str))
{
err = true;
}
...
return err;
}
The C99 semantics for bool are intended to match those of C++.