This keyword is a built-in type. A variable of this type can have values true and false . Conditional expressions have the type bool and so have values of type bool . For example, i != 0 now has true or false depending on the value of i .
In C++, “bool” is a built-in data type that represents boolean values, which can be either true or false. It is commonly used for logical operations, conditional statements, and Boolean expressions in C++ programs.
To put it simply, a Boolean variable can have only two potential values: true or false. To declare this type of variable in C++, we utilize the term bool. Consider the following example: bool b1 equals true; bool b2 equals false; Boolean variables labelled true in C++ are allocated the value 1, whereas false values are assigned the value 0.