bool - C stdbool.h

C examples for stdbool.h:bool

Type

macro

Description

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.

MacroExpands To
bool _Bool
true 1
false0
__bool_true_false_are_defined1

Demo Code

       


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

Related Tutorials