A note on Pointer Operation

We start with the table:

Object Address
xp &xp
*p p

Table 1.

We can illustrate the relationship contained in the table clearer if we also visit the table:

Object Address Object Address
xp &xp *p p
*p p xp &xp

Table 2.

We can gather from this the following assignments:

xp=*p; &xp=p;

*p=xp; p=&xp;

We can immediately see from this that the relationship is commutative, namely that xp=*p and *p=xp or that &xp=p and p=&xp.

Also it occurs that &xp=&*p=p and &*p=&xp=p. Basically it is saying that &*p=p. What about *&xp? Yes, similarly we deduce that *&xp=*p=xp and *p=*&xp=xp, which means *&xp=xp. So we confirm that &xp=p and *p=xp.

Lastly, it also occurs that the operation &* is equivalent to *& in the context provided by Table 1.

Hosted by www.Geocities.ws

1