Name
bool type — Boolean (logical) type specifier
Synopsis
simple-type-specifier := bool
The bool
type represents
Boolean or logical values. The only valid values of the bool
type are the literals true
and false
. A bool
expression can be promoted to an
integer: false
becomes 0
and true
becomes 1
. Arithmetic, enumerated, and pointer
values can be converted to bool
:
0
is false
, a null pointer is false
, and anything else is true
.
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.