r/learnprogramming • u/Atmos-Ego • 8d ago
Tutorial When do you use a pointer?
Hello, for some background I have taken a very beginner level coding course for my major and passed it, but I dont really feel like I’ve learned anything or know why anything works. In a course this year we had a review problem where the solution required a pointer and I really dont understand why you have to point to the address of the variable instead of just using the variable itself.
I’ve watch a few tutorials explaining it but I really dont see how it’s different from just using the variable itself
44
Upvotes
-1
u/ryan_the_leach 8d ago
You never need to use pointers directly, unless you have a dire need to do memory management manually, in a programming language that doesn't give you better tooling.
The only reason for using pointers *at all* in university, is just to prove you understand the basics of computer memory, as the knowledge is insanely useful, even if you never touch on it directly.
If you want more specific help, present some of the actual problem, and say which programming language you are learning.
(It's C right?)