mikroC - C Compiler for Microchip PIC microcontrollers
Relational Operators
Use relational operators to test equality or inequality of expressions. If the expres-
sion evaluates to true, it returns 1; otherwise it returns 0.
All relational operators associate from left to right.
Relational Operators Overview
Relational Operators in Expressions
Precedence of arithmetic and relational operators was designated in such a way to
allow complex expressions without parentheses to have expected meaning:
a + 5 >= c - 1.0 / e
Always bear in mind that relational operators return either 0 or 1. Consider the fol-
lowing examples:
8 == 13 > 5
14 > 5 < 3
a < b < 5
page
104
Operator
==
!=
>
<
>=
<=
// returns 0: 8==(13>5), 8==1, 0
// returns 1: (14>5)<3, 1<3, 1
// returns 1: (a<b)<5, (0 or 1)<5, 1
MikroElektronika: Development tools - Books - Compilers
Operation
equal
not equal
greater than
less than
greater than or equal
less than or equal
// i.e. (a + 5) >= (c - (1.0 / e))
mikroC
making it simple...
Precedence
9
9
10
10
10
10
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?