The Negation Operator

The negation operator (!), read as “not”, performs a logical negation on its single operand.  Negating a false value yields a true value and negating a true value yields false.


1
2
3
bool b1;
b1 = !false;        // true
b1 = !true;         // false