The relational operators group left-to-right, but this fact is not very
useful; a<b<c
(meaning (a<b)<c)
does not mean what it seems to be ((a<b)
and (b<c)
), as in a normal mathematical expression.
relational-expression: expression < expression expression > expression expression <= expression expression >= expression
The operators <
(less than), >
(greater than), <=
(less than or equal
to) and >=
(greater than or equal to) all yield 0
if the specified relation
is false and 1
if it is true.
The type of the result is integer.
The usual arithmetic conversions are performed.
Two strings may be compared. Single
characters are compared from the left
to the right according to their codes in the machine's character set.
Note that a string is always terminated by \0
,
so the shortest string
is considered the smaller. Strings are equal only if their lengths as
well as their contents are identical.
It is an error if the two operands are of different types, but if either
argument in an relational expression is
@
then the value is @
.
Lists and pointers cannot be compared using the relational operators.