In C, there is no boolean data type; C++ added the bool type.
Numeric expressions occurring as if or while conditions are implicitly interpreted as logical true or logical false.
A value of 0 is interpreted as false, while non-zero is interpreted as true.
The unary "bang" operator, !, as applied integers has a result which is either 0 or 1. For integers in a context where a boolean value is expected, the bang operator serves as logical negation.
At the bit level, the bang operator works like this: If any bit of x is non-zero, the result !x is 0. If all bits of x are 0, then !x is 1.