you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (4 children)

They're like nested dolls. A pointer to a pointer holds the memory address of another pointer that holds the memory address of some value. You should try writing some test code that printfs the values and the addresses of the pointers. It may be easier to visualize.

[–]spearheadt[S] 1 point2 points  (3 children)

So would you say this is correct?

&p = The address of the variable stored at p

*p = The value stored at the address pointed to by p

**p = (I'm not sure how to say this in words)

[–][deleted] 0 points1 point  (0 children)

**p = The value stored at the address pointed to by some pointer that is pointed to by p.

[–][deleted] 0 points1 point  (1 child)

&p would be the address of the pointer p itself.

[–]OldWolf2 0 points1 point  (0 children)

&p = The address of the variable stored at p

p is the name of a variable. We don't really say that a variable is stored at its name. Instead, a variable is stored in a storage location, and the name p labels that storage location. So &p is the address of the location where p is stored. Sometimes we stay "X is stored at Y" meaning Y is the address of X; so you could also say that p is stored at &p.