Pointers, still don't know why we use them

Good day,

So I went and watched a few YouTube videos on pointers, I understand what they do now (I think) it allows you to reference a variables memory address, which you are then able to manipulate or use this data stored there.

I think one advantage of this is instead of having another object pull this information with a method and store it in a separate location you can just use a pointer to reference it within said object for memory management purposes.

Outside of this I’m still quite unaware of why we would use pointers, rather than just referencing the variable itself, which already can link to its own memory address.

Cheers,
Matthew

Hey there
I’ve just answered similar question here:

Let me know if that helped you, and if you would like to learn more about them

Privacy & Terms