Why, hello there! :)
This is just a really quick little answer, as I'm sure if you wait
somebody else much more clever than I will probably give a better
response... it just might suffice though, anyway, here goes. :)
Note that C++ does something called passing by reference (it's sort of an
autodereference...), as does Java, but the term has ambiguity anyway.. :)
Anyway, if you want to modify the pointer to point somewhere else, you'll
need to get the address of it (a "reference" to it, if you will), instead
of the value of the pointer (the address that it points to). To do this,
you need a pointer to the pointer! Interesting, no? :)
So, here, let me give you an example:
#include <stdio.h>
int a = 1, b = 2;
int *p;
void point_to_b(int **p);
main()
{
p = &a; /* Start off pointing to a */
printf("*p = %d\n", *p); /* Prints 1 */
point_to_b(&p);
printf("*p = %d\n", *p); /* Prints 2! */
}
void point_to_b(int **p)
{
*p = &b;
}
Hope that helps!! :)