Forget for a second about the pointing analogy. What a pointer really contains is a memory address. The &
is the "address of" operator - i.e. it returns the address in memory of an object. The *
operator gives you the object a pointer refers to, i.e. given a pointer containing an address, it returns the object at that memory address. So when you do *ipp = ip2
, what you are doing is *ipp
get the object at the address held in ipp
which is ip1
and then assign to ip1
the value stored in ip2
, which is the address of j
.
Simply
&
--> Address of
*
--> Value at
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…