Relational operators ('<', '>', '<=' and '>=')

Previous Binary operators Next

The relational operators are used to compare relative values. They use the following syntax:

expr1 < expr2
expr1 > expr2
expr1 <= expr2
expr1 >= expr2
In all relational expressions, the operands must conform to one of the following sets of conditions:
  1. Both expr1 and expr2 are of arithmetic type. In this case, the usual arithmetic conversions are performed and the result is of type int.
  2. Both expr1 and expr1 are pointers to qualified or unqualified versions of compatible object types.
When the operands are of arithmetic type: When the operands are of compatible pointer types, the result depends on the relative addresses of the two objects being pointed at.

Floating point comparisons are internally executed using the fcmp function. See the description of this function for more info about rules of comparisons for floating point values.