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
if you want to store some pointer or anything you will probably use void*.
However if you want to write a function which can be able to initialize this magic pointer, then you need pass this argument to this function as void**
void fun1();
int fun2(int);
double fun3(long);
bool fun4(int, long, double);
int rand(void** pp)
{
switch(time()%4)
{
case 0: *pp = fun1; return 0;
case 1: *pp = fun2; return 1;
case 2: *pp = fun3; return 2;
case 3: *pp = fun4; return 3;
}
}
int main()
{
void* pointer;
int funId;
funId = rand(&pointer);
setCallback(pointer, funId);
}