You can also view a pointer to a pointer as a pointer to an array of pointers, same thing. You dont have to de-reference it before passing it to your function.
You de-reference it in the function.
Either as an array, 'data_ptr[x]' or as an offset, '*(data_ptr + x)'
Code:
Code:
int main(void)
{
char **data_ptr;
data_ptr[0] = "hello"; /* Pointers to strings */
data_ptr[1] = "Goodbye";
data_ptr[2] = "World";
req_proc(data_ptr);
return 0;
}
void req_proc(char **data_ptr)
{
char *temp;
char *Data = "Cruel"; /* Pointer to string */
data_ptr[0] = Data;
Data = data_ptr[1];
temp = *(data_ptr + 2); /* Another way */
}