Overview:
An expression that consists of operands and operators.
In the written examination, the usual test center has the operator's priority, the XOR and the equal relation operation .
4.1 Assignment Statements
The assignment operator "=", the left side of the operator represents the address of the storage unit, called the left value, and the right side of the table is the desired value, called the right value.
Note: The left operand of the assignment operator must be a non-const left value .
int Const& Max (int Const& A,int Const&b) {returna > B?a:b;}int& Fun (int&a) {a+=5; returnA;}int* FUN2 (int*a) {returnA;}intMain () {intII =Ten, j = -; Fun (ii)= -;//statement 1 correctly executed after II =printf"%d", ii); Max (II, J)= $;//Statement 2 error expression max (II, J) is not a modifiable lvalueprintf"%d", ii); Fun2 (&II) = $;//Statement 3 error cannot be converted from int to int*printf"%d", ii); *fun2 (&II) = $;//Statement 4 is correctprintf"%d", ii); System ("Pause");}
Second, the assignment operator has a right-associative property. When the expression contains multiple assignment operators, the right-to-left combination.
4.2 Self-increment and decrement operators
The prefix operation "first change after use", and then the "first change after".
Take + + as an example:
Prefix: ++a means take the address of a, add its contents, and then put the value in the Register;
Suffix: a++ represents the address of a, loads its value into a register, and then increments the value of memory a.
For personal reasons, see here first today, tomorrow continue to ^-^, not to be continued .....
[Basic-C + +-written assault] 4. Operators and Precedence