as we use pointers in the argument list of functions like
void f(int *);
this means that this function will receive a pointer to an integer
but what does this means
void f(int ***);
and
void f(int **=0)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
means that the function receives a pointer to a pointer to a pointer to an int. This would work with it:
Now about the 2nd one, its a function that receives a pointer to a pointer to an int, and if you give it nothing, it defaults to 0.
UPDATE:
A practical application of this kind of double pointers is a memory allocation routine like:
This function returns
true/falsedepending on whether or not it worked and would update the pointer you pass in with the real memory address, like this:You pass in an uninitialized pointer and the function can overwrite it with a real value because you passed a pointer to the actual pointer. At the end,
memcontains a pointer to valid memory.Another application, more common but a lot less enlightening, is an array of arrays (so-called jagged arrays).