Two special Operators related to pointers:
1. "&" the address operator can be used to retrieve the addresses of common variables;
2. "*" has two meanings:
1. pointer flag: whether the pointer flag is used depends on whether there is a type in the front. Here there is an int
2. pointer OPERATOR:
The value is on the right of the equal sign. * The values of common variables pointed to by pointer variables can be retrieved.
Assign a value to the left of the equal sign. * You can change the value of the common variable pointed to by the pointer variable to another variable.
3. It is a multiplication operator. Only when both the left and right are variables. .
For example
Int a, B = 20, c = 30, d = 40, * p; (correct, here * is the pointer sign, which only serves to the left and right of the definition, no value or value assignment function. Whether it is a pointer flag mainly depends on whether there is a type in the front, where there is an int at the top)
P = & d; (correct, p points to the address of d)
A = * p; (correct, here * is the value. Finally, the value of a is changed to 40 of d)
* P = c; (correct, * here is the value. Finally, the value of d is changed to the value 30 of C)
* P = & B; (RUN error, content value on the left, address on the right, not equivalent)
----------------------------
Equivalent expression
If the pointer Variable p points to variable a, the address of variable a is assigned to the pointer Variable p.
For example, int a = 20, * p = &;
The result is as follows:
A, * p <=>
B, p <=> &
C. & * p <=> & a <=> p
D, * & a <=> * p <=>
E, (* p) ++ a ++
(* P) -- --
++ (* P) ++ a ++ * p
-- (* P) -- a -- * p