***Pointer notation

I had a question about certain kind of pointers. If you had say int **Ptr; How does that exactly work. I know normal pointers from pointing to int variables to pointers to dynamically allocated memory. But i'm not sure how this notation works exactly. If I can get a few examples and how it works that would be awesome, I tried to search it and only got regular pointer stuff. Thanks!
If you are asking what it means, it is a pointer to a pointer. If you read it right to left, it might help and is how I used to remember. "Ptr" is a pointer(*) to a pointer(*) to an int

1
2
3
4
5
6
7
8
9
10
11
12
int main()
{
int var = 8;
int* ptr;
int** pptr;

//ptr is a pointer to integer var
ptr = &var;
//pptr is a pointer to pointer ptr
pptr = &ptr;

}
Last edited on
Topic archived. No new replies allowed.