Let's define out custom type:
typedef char mytype_t,;
Now we want to pass that variable to a function to modify it. In order to do that, we need to pass it by address, right?
So,
mtype_t mydata;
foo(&mydata);
And
Code:
void foo(mytype_t * data)
{
*data = 'H';
}
Easy. Right?
Now let's redefine our type a little:
typedef const char* mytype_t;
And we once again pass it to a function:
mtype_t mydata;
foo(&mydata);
And
Code:
void foo(mytype_t * data)
{
*data = "Hello World!"; // We probably should have malloc or something here, but this serves the example fine.
}
No problems! We've seen this stuff before.
Now let's substitute mydata_t for the type it's an alias for, and we get:
const char * mydata;
foo(&mydata);
And
Code:
void foo(char const* * data)
{
*data = "Hello World!"; // We probably should have malloc or something here, but this serves the example fine.
}
There you go. A double pointer.
The reason for the casting is probably because the function takes an opaque pointer (ie void*). Thus it needs to convert it to its real type before doing something with it.