Boolean types
A Boolean variable can be used to hold the integer values 0 or
1, or the literals true or false,
which are implicitly promoted to the integers 0 and 1 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.
_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.
Beginning of C only.
Boolean types are a C99 feature. To declare a Boolean variable,
use the bool type specifier.
End of C only.
Beginning of 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.
End of C++ only.