bool literal
From cppreference.com
[edit] Syntax
| true | (1) | ||||||||
| false | (2) | ||||||||
[edit] Explanation
- boolean
true(a prvalue of typebool, implicitly convertible to the value 1 of typeint.) - boolean
false(a prvalue of typebool, implicitly convertible to the value 0 of typeint.)
[edit] Example
Run this code
#include <iostream> int main() { std::cout << std::boolalpha << true << '\n' << false << '\n' << std::noboolalpha << true << '\n' << false << '\n'; }
Output:
true false 1 0