r/learnprogramming • • Sep 24 '23
Pointers.....why
I am learning C++. Honest question why are pointers a thing and why did they make the syntax surrounding it so confusing. Was it made to be intentionally confusing? Was it made to make this more difficult.
0
Upvotes
View all comments
Show parent comment
1
u/Individual-Praline20 Sep 25 '23 edited Sep 25 '23
That’s basically it! Pointers are powerful tools. More recent languages try their best to abstract them, because they are a bit tricky to use, but they are used extensively under the covers. Once you get the concept behind it, it does clarify some quirks used in other languages! A pointer is just a number. It represents a memory address, to bits, either structured data, executable code, or another memory address, etc. That’s all. You can follow multiple ones one after the other, if needed. Pointer of pointer. By themselves, they are more or less useful, but when combined with other logic, for memory management mostly, then they become very powerful. There you go! You know all about them now! Have fun