Boolean literals are literals that have either the meaning true or false. There are only two Boolean literals in C++: true and false. These literals are of type bool. You can use them as −
Example
#include<iostream>
using namespace std;
int main() {
bool my_bool = true;
if(my_bool) {
cout << "My bool is true!" << endl;
}
return 0;
}Output
This will give the output −
My bool is true!