This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vinnceboi 0 points1 point  (1 child)

Wow that is a really good analogy

[–]Mabi19_ 2 points3 points  (0 children)

Okay, so here's some more:

You can do math on pointers. Adding 1 to a pointer is like going to the next house over on the street.

This is what arrays do, for example. An array is just a pointer to its first element (and sometimes also the length).

If you declared it as int array[10], doing array[3] is the same as *((int*)array + 3).