
Tridip C. answered 08/09/20
Tutor
4.9
(332)
5+ years of Experience in Programming in C/C++
The logical NOT operator (!) takes any expression as operand and evaluates its truth value before returning the negation of the truth value as output.
In C/C++ any int/float/long/double type variable with a non-zero value is regarded as TRUE. Therefore,
float a = 2.5; // when used with a boolean operator, this value is considered TRUE
!a; // returns FALSE