What Pointer are. Took me awhile to figure out

The wording of pointers really confused me. So I had to look up other videos to figure out.

From what I understand, pointers are ways of referencing the same place in memory with different variables.

Imagine that ‘a’ lives in a place in the computer. When you say b = a, ‘b’ gets assigned to the value of ‘a’. Now imagine you say c = a. Now, b and c both ‘point’ to the same thing.

So, writing “b* a” makes ‘b’ point to ‘a’. ‘a’ could be a class, a function, or a variable. Then doing c* a makes ‘c’ a pointer as well.

This will allow you to use ‘a’ in multiple different locations without having to pass it around.

Privacy & Terms