最初由 thyme 发布
看看这个小程序:
int x = 1, y = 2, z[10];
int *ip; /* ip is a pointer to integer */
ip = &x; /* ip now points to x */
y = *ip; /* y now is one == content of what ip points to, which is the value of x, and x = 1. */
*ip = 0; /* x now is zero == content of what ip points to is assigned to be zero. */
ip = &z[0]; /* ip now points to the first element of string z, z[0] */
.... ...
通过不停转换这个pointer指向谁(其实就是说,不停改换ip是谁的地址address),我们可以改变被指向者的值(content)。