##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Comparison operators

From cppreference.com
< c‎ | language

Comparison operators are binary operators that test a condition and return 1 if that condition is logically true and 0 if that condition is false..

Operator | Operator name | Example | Description
--- | --- | --- | ---
== | equal to | a == b | a is equal to b
!= | not equal to | a != b | a is not equal to b
< | less than | a < b | a is less than b
> | greater than | a > b | a is greater than b
<= | less than or equal to | a <= b | a is less than or equal to b
>= | greater than or equal to | a >= b | a is greater than or equal to b

### [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_comparison&oldid=41447"