C++ pointer, *, reference, &

指针*,引用&,解引用*,取地址&


&可以作为取地址用。&a返回取a的地址,a是一个对象。&映射对象到地址。

In this case, & can be called Address of operator.


*可以作为解引用操作符。*p返回p所指向的对象,p是一个地址。*映射地址到对象。

In this case, * can be called Indirection operator. Indirection operator returns the value of the variable located at the address specified by its operand.


Indirection operator * is the complement of Address of operator &.

References: