Relational Operators (C++)
Go Up to Binary Operators Index
Syntax
relational-expression < shift-expression relational-expression > shift-expression relational-expression <= shift-expression relational-expression >= shift-expression
Considerations about Relational Operators
Use relational operators to test equality or inequality of expressions. If the statement evaluates to be true it returns a nonzero character; otherwise it returns false (0).
| Relational Operator | Description |
|---|---|
|
> |
greater than |
|
< |
less than |
|
>= |
greater than or equal to |
|
<= |
less than or equal to |
In the expression:
E1 <operator> E2
the operands must follow one of these conditions:
- Both
E1andE2are of arithmetic type. - Both
E1andE2are pointers to qualified or unqualified versions of compatible types. - Either
E1orE2is a pointer to an object or incomplete type, and the other is a pointer to a qualified or unqualified version of void. - Either
E1orE2is a pointer, and the other is a null pointer constant.