Easy Table for Understanding Pointers

An easy pair of rules are that:

  1. A pointer stores an address, so when you use the bare pointer, you get that address back. You have to add something extra, the asterisk, in order to retrieve or modify the value stored at the address.
  2. A variable stores a value, so when you use the variable, you get its value. You have to add some extra, the ampersand, in order to retrieve the address of that variable.
9 Likes

This is a fantastic reference. Thanks for sharing it here. I have added it to this post: Recommended C++ resource

2 Likes

Thanks for that, handy

1 Like

No problemo!!!

what is different between *(pointer) and &(reference) both of them get address and return value?

Actually &(reference) will return the address of the reference. Just reference will return the value.

great table!

Privacy & Terms