Don't point, it's rude!
Ok, so we have learned about the address-of operator (&) and the
reference operator (*), but we haven't learned how to declare a pointer
to use these operators on. Well this is how you do it:
int *melissa;
That's it! This will move a person named melissa into a house,
who's sole purpose is to store the address of someone else in computer
town. Basically, she is a pointer!
There are a few rules that I should explain before we go and learn
how to tell her where to point. If we have a line of code like this:
int *melissa, paul;
This does not create two pointers, melissa and paul.
It actually creates a pointer of size int named melissa and a
regular int named paul. If we want to declare two pointers of
the same type we would do this:
int *melissa, *paul;
This will create two pointers of size int named melissa and
paul.
Another thing is size. A pointer must know how big the house it is
pointing to. So if paul is an int, only an int pointer can point
to it. If paul is a float, then only a float pointer can point
to it, and so on.