exclamation mark in c 1

exclamation mark in c

The negation operator (!) simply just reverses the meaning of its operand.

The operand or the expression must be of arithmetic or pointer type. But the operand/result of expression is implicitly converted to data type bool (boolean 0 means false, Non zero means True).

The result is true if the converted operand is false; the result is false if the converted operand is true. The result is of type bool.

Here is what the above code is Doing:
1. The expression (a > b) is evaluated.
2. The result of the expression is converted to bool.
3. The result of the conversion is negated.

Similar Posts