set bool equal to statement c+ code example Example: how to initialize a boolean in c++ bool b1 = true; // declaring a boolean variable with true value