Logical operators - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Logical operators

From cppreference.com
< c‎ | language

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

### [edit] Short-circuit evaluation

`&&` and `||` perform short-circuit evaluation (do not evaluate the second operand if the result is known after evaluating the first).

### [edit] See Also

Operator precedence

Common operators
assignment | increment decrement | arithmetic | logical | comparison | member access | other
a = b a += b a -= b a *= b a /= b a %= b a &= b a |= b a ^= b a <<= b a >>= b | ++a --a a++ a-- | +a -a a + b a - b a * b a / b a % b ~a a & b a | b a ^ b a << b a >> b | !a a && b a || b | a == b a != b a < b a > b a <= b a >= b | a[b] *a &a a->b a.b | a(...) a, b (type) a ? : sizeof _Alignof (since C11)

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/language/operator_logical&oldid=41446"