Logical Operators
Go Up to Binary Operators Index
Syntax
logical-AND-expression && inclusive-OR-expression logical-OR-expression || logical-AND-expression ! cast-expression
Remarks
Operands in a logical expression must be of scalar type.
&& logical AND; returns true only if both expressions evaluate to be nonzero, otherwise returns false. If the first expression evaluates to false, the second expression is not evaluated.
|| logical OR; returns true if either of the expressions evaluate to be nonzero, otherwise returns false. If the first expression evaluates to true, the second expression is not evaluated.
! logical negation; returns true if the entire expression evaluates to be nonzero, otherwise returns false. The expression !E
is equivalent to (0 == E
).