pointers to pointers

closed account (4ET0pfjN)
I'm confused, so if I declare int **p

does that mean p is pointer to a pointer or do I have to create another pointer like: int *q and then make p point to q. This pointer stuff is hard...
does that mean p is pointer to a pointer

Yes.

1
2
3
int a;  // a is an int
int* b; // b is a pointer to an int (ie, it could point to 'a')
int** c;  // c is a pointer to a pointer to an int (ie, it could point to 'b', but not to 'a') 


do I have to create another pointer like: int *q and then make p point to q.


That's one way to do it, yes. But you don't have to, I guess.

This pointer stuff is hard...


It's not that bad once you get the idea.
Topic archived. No new replies allowed.