Boolean types

A Boolean variable can be used to hold the integer values 0 or 1, C++ only beginsor the literals true or falseC++ only ends, which are implicitly promoted to the integers 1 and 0 respectively, whenever an arithmetic value is necessary. The Boolean type is unsigned and has the lowest ranking in its category of standard unsigned integer types; it may not be further qualified by the specifiers signed, unsigned, short, or long. In simple assignments, if the left operand is a Boolean type, then the right operand must be either an arithmetic type or a pointer.

Begin C only Boolean type is a C99 feature. To declare a Boolean variable, use the _Bool type specifier.

IBM extension The token bool is recognized as a keyword in C only when used in a vector declaration context and vector support is enabled. End IBM extension

C++ only To declare a Boolean variable in C++, use the bool type specifier. The result of the equality, relational, and logical operators is of type bool: either of the Boolean constants true or false.

You can use Boolean types to make Boolean logic tests. A Boolean logic test is used to express the results of a logical operation. For example:
_Bool f(int a, int b)
{
  return a==b;
}
If a and b have the same value, f returns true. If not, f returns false.