Category: Type specifier

Syntax: bool <identifier>

Description

Use bool and the literals false and true to perform Boolean logic tests.

The bool keyword represents a type that can take only the value false or true. The keywords false and true are Boolean literals with predefined values. false is numerically zero and true is numerically one. These Boolean literals are rvalues; you cannot make an assignment to them.

You can convert an bool rvalue to an rvalue that is int type. The numerical conversion sets false to zero and true becomes one.

See also:

Type Specifiers