5.80 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;
}

Note

The C99 semantics for bool are intended to match those of C++.

Related concepts
5.64 New library features of C99
5.78 Additional <math.h> library functions in C99
5.79 Complex numbers in C99
5.81 Extended integer types and functions in <inttypes.h> and <stdint.h> in C99
5.82 <fenv.h> floating-point environment access in C99
5.83 <stdio.h> snprintf family of functions in C99
5.84 <tgmath.h> type-generic math macros in C99
5.85 <wchar.h> wide character I/O functions in C99
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.