i want to understand that what is bolean data type in c++. I tried to my best but i can not understand boolean data type plz help me

The built-in Boolean data type in C++, bool, is quite simple: it is a data type which can hold one of two values, true or false. It can be used to hold a truth value for comparisons:

bool overflow = false;

while (!overflow)
    //  ... do some things 

    overflow = (foo > bar);

    // ... do some more things

In this case, it is used becausse there are actions both before and after the place where the value is checked, so it cannot be in just the conditional of the while() loop.

It is most often used as the return value for a function that returns a true or false result based on some test.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.