Popular Google Pages:
◕ Bengali Story writing competition. More..
◕ This article is regarding What is bool Type in C++?
Last updated on: 28th December 2016.
◕ What is bool Type in C++?
In C++, a Boolean variable is one whose value is either true or false.
The name bool came after the name of the great English mathematician George Boole.
Normally nonzero values as true and zero values as false.
This type are greatly used in the if statements.
◕ Example statements of bool type are as follows:
▨ We can use the bool type to represent true and false.
The predefined literals true and false represent those values as the given example statement.
bool great_india = true;
▨ The literals true and false can be converted into int type.
Then true is 1 and false is 0:
int sun = true; // int sun assigned 1
int earth = false; // int earth assigned 0
▨ Any numeric value can be converted to a bool value.
As nonzero value converts to true, whereas a zero value converts to false.
bool pin = -100; // pin assigned as true
bool unpin = 0; // unpin assigned as false.
How to display a value in Hexadecimal form in C++?
How C++ identify the base of a number?
Symbolic Constant in C++
Top of the page