- #1
MinusTheBear
- 22
- 0
Hey everyone,
I'm currently going over a chapter on pointers for my 2nd programming course (no prior experience outside of class). I'm wondering what the usefulness of pointers is, other than if you need direct access to the memory location of a variable.
The text essentially says it's good for dynamically allocating memory for arrays that you don't know the size of. However, every example they've given so far, I am able to code another way without pointers. And it makes the code way easier to follow (in my opinion).
The only thing that I can think of is that it could potentially increase the efficiency of the code since you can delete the pointer when you're done with it and re-create it when you need it. However, isn't this essentially the same as a local variable just with a little more flexibility?
Currently it just seems like a more surefire way to end up with errors.
I'm currently going over a chapter on pointers for my 2nd programming course (no prior experience outside of class). I'm wondering what the usefulness of pointers is, other than if you need direct access to the memory location of a variable.
The text essentially says it's good for dynamically allocating memory for arrays that you don't know the size of. However, every example they've given so far, I am able to code another way without pointers. And it makes the code way easier to follow (in my opinion).
The only thing that I can think of is that it could potentially increase the efficiency of the code since you can delete the pointer when you're done with it and re-create it when you need it. However, isn't this essentially the same as a local variable just with a little more flexibility?
Currently it just seems like a more surefire way to end up with errors.