##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# bool literal

From cppreference.com
< cpp‎ | language

### [edit] Syntax

true | (1) |
false | (2) |

### [edit] Explanation

1. boolean `true` (a prvalue of type `bool`, implicitly convertible to the value 1 of type `int`.)
2. boolean `false` (a prvalue of type `bool`, implicitly convertible to the value 0 of type `int`.)

### [edit] Example

Run this code

    std::cout << std::boolalpha
              << true << '\n'
              << false << '\n'
              << std::noboolalpha
              << true << '\n'
              << false << '\n';

Output:

    true
    false
    1
    0

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/language/bool_literal&oldid=67107"