Two operators are commonly used in working with pointers, the address (&) operator and the indirection (*) operator. You can use the & operator to refer to the address of an object. For example, the assignment in the following function assigns the address of x to the variable p_to_int. The variable p_to_int has been defined as a pointer:
void f(int x, int *p_to_int) { p_to_int = &x; }
The * (indirection) operator lets you access the value of the object a pointer refers to. The assignment in the following example assigns to y the value of the object that p_to_float points to:
void g(float y, float *p_to_float) { y = *p_to_float; }
The assignment in the following example assigns the value of z to the variable that *p_to_char references:
void h(char z, char *p_to_char) { *p_to_char = z; }
Related References