ABL electronic PIC12 Benutzerhandbuch

Seite von 312
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   
// i.e. (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
// returns 0: 8==(13>5), 8==1, 0
14 > 5 < 3
// returns 1: (14>5)<3, 1<3, 1
a < b < 5
// returns 1: (a<b)<5, (0 or 1)<5, 1
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
104
MikroElektronika:  Development  tools  -  Books  -  Compilers
page
Operator
Operation
Precedence
==
equal
9
!=
not equal
9
>
greater than
10
<
less than
10
>=
greater than or equal
10
<=
less than or equal
10