Logical operators
From cppreference.com
Logical operators apply standard boolean algebra operations to their operands.
Operator | Operator name | Example | Result |
---|---|---|---|
! | logical NOT | !a | the logical negation of a |
&& | logical AND | a && b | the logical AND of a and b |
|| | logical OR | a || b | the logical OR of a and b |
Short-circuit evaluation
&&
and ||
perform short-circuit evaluation (do not evaluate the second operand if the result is known after evaluating the first).
See Also
Common operators | ||||||
---|---|---|---|---|---|---|
assignment | increment decrement |
arithmetic | logical | comparison | member access |
other |
a = b |
++a |
+a |
!a |
a == b |
a[b] |
a(...) |