Why do pointers exist? So that you can change the value of a variable from another scope, for one thing. What if the variable you wanted to change was a pointer itself?
Code:
char name[] = "Anonymous";
set_name(&name);
void set_name(char **name) {
strcpy(*name, "Samuel");
}
That's the main reason for pointers-to-pointers. If pointers to variables are a good thing, then sooner or later you're going to need a pointer to another pointer.
void pointers are a special case. Because a void pointer can hold the value of any pointer, of any indirection level, this code is perfectly valid:
Code:
int x;
void *a = &x, *b = &a, *c = &c;
*(int *)a = 0;
**(int **)b = 0;
***(int ***)c = 0;
You just have to remember what you stored in the void pointer when you decide to go and retrieve it.
There are issues with pointers-to-pointers, of course. const doesn't play well with them, for reasons I don't feel like explaining. Many people would rather return a modified pointer rather than take a pointer-to-pointer as a parameter to a function:
Code:
char name[] = "Anonymous";
strcpy(name, set_name(name));
char *set_name(char *name) {
return "Samuel";
}
But pointers-to-pointers definitely have their place. If you do a board search you might turn up some more information.