It\'s the special property that void* can also be assigned a pointer to a pointer and cast back and the original value is received.
I read this line
A void *
can hold any pointer. Since there are no actual void
objects, a void *
is always a pointer to some other type.
A void **
is a pointer to a pointer to void, or the address of a void *
, i.e., the address of a pointer to void. This is an actual type and doesn't have any magic properties.
But since a void *
can hold any pointer, it can also hold, for example, a void **
.
void **f(int x) {
static void *y;
static int *iy;
y = &x;
iy = &x;
// return &iy; // not ok
return &y; // ok
}