about pointers

what is teh differnece between

int* ptr;
and
int** ptr;

what does dereferencing actualyl do?
int* ptr is a pointer

and

int** ptr is a pointer to a pointer

The first one tells the compiler that this element holds the adress of a piece of data, the second one says this holds the address of a pointer.
int*ptr is a pointer to int
int**ptr is a pointer to a pointer to int
“dereferencing” means accessing the memory pointed by some pointer
By the way we aren't trying to be dismissive, especially about a subject that so many people misunderstand, so if you have follow up questions please post them. The answer is short because it's a concept that doesn't take a lot of words to explain, but we can go into more detail if need be.
Last edited on
Topic archived. No new replies allowed.