Relational Operators
C's relational operators correspond
to the <, >, < and > operators of mathematics, except that they
produce 0 (false) or 1 (true) when used in expressions. For example, the value
of 10 < 11 is 1; the value of 11 < 10 is 0.
Symbol
|
Meaning
|
<
|
less than
|
>
|
greater than
|
<=
|
less than or equal to
|
>=
|
greater than or equal to
|
The
relational operators can be used to compare integers and floating-point
numbers, with operands of mixed types allowed. Thus, 1 < 2 .5 has the value
1, while 5 .6 < 4 has the value 0.
No comments:
Post a Comment