I'm a programming student with two classes in C#, but I'm just taking my first class in C++, and thus I'm being exposed to pointers.
I know how they work, and the proper way to use them, but I wondered about some of the ways that professional programmers use pointers in their programs.
So how do you use pointers? Or do you?
This will help me understand some practical applications for pointers, so thanks!
Any time you'd use a reference in C#. A "reference" is just a pointer with fancy safety airbags around it.
I use pointers about once every six lines in the C++ code that I write. Off the top of my head, these are the most common uses:
For staters, you use them in your data structures, like linked list, etc. Anyplace you need dynamically allocated memory, that is, memory that you don't know the size of at compile-time, you will be using a pointer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With