Delivery note fine imitation

Delivery note fine imitation

Ten 〓 〓 reed [2675831689] "credit protection"
to write code, we can manipulate the value stored in memory by variable assignment, such as addition and subtraction.
I have not thought about what variables represent? In fact, a variable section corresponding to memory space,
this space is stored in the corresponding value of the variable type. Corresponds to the address value of the pointer variable, only by a pointer,
can read or update the value of variables, without the need to use the variable name.
var i int = 10 // declare the variable i, and initialized to 10
var * ptr int i = &
fmt.Println (ptr, * ptr)
// 10 0xc000018060 ptr pointer variable i is stored in the address, * ptr pointer variable corresponding value
* ptr = 12 // i = 12 variables are updated pointer value
fmt.Println (* ptr, i) // 12 12
  the above code, declared type * int pointer variable PTR, by taking the address operator & get a pointer to an integer variable i address. It can be said, ptr pointer points to a variable i, or ptr pointer to save the address of the variable i

Guess you like

Origin www.cnblogs.com/fdsf568/p/12440167.html