C++ Booleans

Booleans represent true/false. 2 states of data. These help to make decisions. Booleans occupy 1 byte memory.

Declaring bool variables

Printing bool values to output – std::boolalpha

In general, boolean value true represents 1, false represents 0. This is how, the boolean values gets printed on the console output.

However, we can use std::boolalpha to force the output format to true/false.

This flag can be unset with the noboolalpha manipulator.