Increment and decrement assignment operator
(I) the assignment operator
problem:
The assignment operators and the equal sign in mathematics What's the difference?
⑴ directional, the calculated result of the right assigned to the variable on the left;
data type ⑵ left and right should be consistent;
data types of the left and right ⑶ if not, converts the data type to the left of the right data type.
Assignment operator: variable = expression.
㈡
Requirements: operand is a variable, not a constant or expression.
Programming, often the variables are as follows:
i = i + 1 i = i -1
In this case, the counter variable i is called
(Iii) increment and decrement
Front (Formula prefix) and rear (postfix) calculation:
++ i some --i:
Pre-reduction is to have the reference, i.e., from the first variable plus or minus from, with the new value involved in other operations;
i ++ some i--:
After the first rear reference is increased or decreased, i.e., involved in other operations with the original value of the variable, then the variables are from plus or decrementing.
summary
⑴ rules increment and decrement of priority;
⑵ assignment operator priority lower than the increment decrement operators and arithmetic operators;
⑶ assignment operation should be the same on both sides of the data type; different sides if the data type, converts the data type to the left of the right data type;
⑷ compound rule assignment operation;
⑸ tired multiply, implementation mechanism cumulative.
⑹