##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# _Bool

From cppreference.com
< c‎ | keyword

Implements a Boolean type.

| This section is incomplete Reason: needs content

### [edit] Keywords

`_Bool`

### [edit] Example

Run this code

    #include <stdio.h>

    int main(void)
    {
        printf("sizeof(_Bool) = %zu\n", sizeof(_Bool));

        _Bool b;
        b = 2;
        printf("b  = %d\n", b);    // 2 or 1?
        printf("!b = %d\n", !b);   // 0

        b = 0;
        printf("!b = %d\n", !b);   // 1

        if (b) printf("true\n");   // false
        else   printf("false\n");

        return 0;
    }

Possible output:

    sizeof(_Bool) = 1
    b  = 1
    !b = 0
    !b = 1
    false

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/keyword/_Bool&oldid=70247"
Category:

- Todo with reason