In C++, a boolean data type is defined using the keyword bool
. A boolean variable can only have two possible values: true
or false
. In C++, Boolean values declared true
are assigned the value of 1, and false
values are assigned 0. Any time a Boolean variable is used in C++, it is declaring that the variable can have only one of two possible values: true
(1) or false
(0) . The most common use of the bool
data type is for conditional statements.
what is bool in c++
