Reference to a pointer to a pointer
Exercise 7 from Chapter 11 of Bruce Eckel's "Thinking in C++":
Create a function that takes an argument of a reference to a pointer to a pointer and modifies that argument. In main( ), call the function.
I'm having difficulty figuring out exactly what I can pass as an argument to a function which takes an argument of that kind. For example:
Code:
void f1(int**& x)
{
x++;
}
int main()
{
int x = 0;
int *px = &x;
int **ppx = &px;
f1(ppx); // fine
//f1(&px) doesn't work
return 0;
}
I guess what I'm having trouble understanding is why I can pass ppx but not &px.