Basic facilities
- slide 3 : 42
Booleans
There is a type
bool
in C++
Boolean constants
true
and
false
The C++ Programming Language
: Page 71
Type
bool
in relation to other fundamental types
Boolean values are converted implicitly to integers in arithmetic and logical expressions:
false
to 0 and
true
to 1.
Integers can be converted implicitly to booleans: 0 to
false
, other values to
true
.
Pointers can implicitly be converted to boolean values as well
Under the hood the well-known C boolean conventions still apply