Boolean Data Type
How is "boolean" datatype used in C++?.
Explanation
The
"boolean" data type is used to represent boolean values that returns either "true" or "false". Usually the values are returned as 0 or 1.
Example :
#include <iostream.h> using namespace std; void main() { int a=10; int c=0; bool b= (acout << "The Boolean Value is::" << b << '\n'; } |
Result :
The Boolean Value is:: 0
In the above example, the a boolean value returned by the data type is "0" since the expression is false.