[Main]
Title=Relational operators ('<', '>', '<=' and '>=')
Index=<, >, <=, >=

[Top]
The relational operators are used to compare relative values.
They use the following syntax:
<PRE><I>expr1</I> &lt; <I>expr2</I>
<I>expr1</I> &gt; <I>expr2</I>
<I>expr1</I> &lt;= <I>expr2</I>
<I>expr1</I> &gt;= <I>expr2</I>
</PRE>
In all relational expressions, the operands must conform to one of the
following sets of conditions:
<OL>
<LI>
Both <I>expr1</I> and <I>expr2</I> are of arithmetic type.
In this case, the usual arithmetic conversions are performed and the result
is of type <CODE>int</CODE>.
</LI>
<LI>
Both <I>expr1</I> and <I>expr1</I> are pointers to qualified or unqualified versions
of compatible object types.
</LI>
</OL>
When the operands are of arithmetic type:
<UL>
<LI>
<I>expr1</I> &lt; <I>expr2</I> gives 1 (true) if the value of <I>expr1</I>
is less than value of <I>expr2</I>; otherwise, the result is 0 (false).
</LI>
<LI><I>expr1</I> &lt;= <I>expr2</I> gives 1 (true) if the value of <I>expr1</I>
is less than or equal to the value of <I>expr2</I>; otherwise, the result is 0
(false).
</LI>
<LI>
<I>expr1</I> &gt; <I>expr2</I> gives 1 (true) if the value of <I>expr1</I>
is greater than the value of <I>expr2</I>; otherwise, the result is 0 (false).
</LI>
<LI>
<I>expr1</I> &gt;= <I>expr2</I> gives 1 (true) if the value of <I>expr1</I>
is greater than or equal to the value of <I>expr2</I>; otherwise, the result is 0 (false).
</LI>
</UL>
When the operands are of compatible pointer types,
the result depends on the relative addresses of the two
objects being pointed at.
<BR><BR>
Floating point comparisons are internally executed using the
<A HREF="$$LINK(timath.h/fcmp)">fcmp</A> function. See the description of this function for
more info about rules of comparisons for floating point values.
