mikroC

making it simple...

mikroC - C Compiler for Microchip PIC microcontrollers

Thus, we have 10 different compound assignment operators: +=, -=, *=, /=, %=, &=, =, ^=, <<=, and >>=. All of these associate from right to left. Spaces separating compound operators (e.g. + =) will generate error.

Compound assignment has the same effect as

expression1 = expression1 op expression2

except the lvalue expression1 is evaluated only once. For example,

expression1 += expression2

is the same as

expression1 = expression1 + expression2

Assignment Rules

For both simple and compound assignment, the operands expression1 and expression2 must obey one of the following rules:

1.expression1 is a qualified or unqualified arithmetic type and expression2 is an arithmetic type.

2.expression1 has a qualified or unqualified version of a structure or union type compatible with the type of expression2.

3.expression1 and expression2 are pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left has all the qualifiers of the type pointed to by the right.

4.Either expression1 or expression2 is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void. The type pointed to by the left has all the qualifiers of the type pointed to by the right.

5.expression1 is a pointer and expression2 is a null pointer constant.

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

111