1.6 Compound Assignment Operators
1. Exam Points
compound assignment operators (+=, -=, *=, /=, %=)
- c += a is c = c + a
- c *= a - b is c = c * (a-b)
Increment and decrement
- ++: a++ is a=a+1
- --: b-- is b=b-1
Operator precedence
assignment operators: =, +=, -=, *=, /=, %= have the lowest precedence.
type casting has a higher precedence over arithmetic operators.
() can be used to change precedence of a certain part.
2. Knowledge Points
(1) Compound Assignment Operators
- A
compound assignment is a combination of an arithmetic operator (+, -, *, /, %) and the equal sign =.
Compound assignment operators:

(2) Increment Operator (++) and Decrement Operator (--)
- The
post-increment operator ++ adds 1 to a value.
- The
post-decrement operator -- subtracts 1 from a value.

3. Exercises