Google News
logo
CPP - Interview Questions
What is bool in C++?
Bool is a data type in C++ which takes two values- True and False. Syntax is as follows:
bool b1 = true;
 
A sample code is as follows :
#include<iostream> 
using namespace std; 
int main() 
{ 
    int a= 4, b= 5; 
    bool c, d; 
    c= a== b; // false 
       
    c= a< b; // true 
       
    cout <<b1; 
    cout << b2 ; 
           
    return 0; 
}
Advertisement