Go pointer
1. Definition
1. var pointer name * pointer type, eg:,var ptr *int
define an integer pointer named ptr
2. Pointer type: pointer variable stores an address, and the space pointed to by this address is the value that
can be assigned to Pointer, eg:,var ptr *int =&num
and then use to*ptr
get the value of num
Second, the pointer precautions
&
meanings of the symbols is a variable taking address, such as: the address of a variable is &a
*
the symbol means address values
, such as: *&a
, where a variable is a value of the address, of course, is a value of a
Simple Explanation : *
and &
can counteract each other, but not vice versa
Three, pointer related icons
var num int =1
var i int = 999
var ptr *int=&i
After reading, if it is helpful to yourself, please like and support, thank you