One of the aspects of C++ I remember struggling with a bit was pointers. So, I want to make sure and jot down some of the things I’m learning about them.
I referenced this website: http://www.cplusplus.com/doc/tutorial/pointers/
I may reference it again for other topics. I am going through another book on C++, and just reached the Pointers chapters, so I may have another post on this topic.
Here’s what I learned about pointers:
Essentially, the pointer is a variable that contains an address — it points to the address of another variable. From my understanding, pointers are useful since you can manipulate data simply by pointing to its address and dereferencing it, rather than having to pass the data itself onto the stack. Imagine having to pass a large value or an array onto the stack.
Pointers and Arrays
Pointers and const
Pointers to pointers
Pointers to Functions
The screenshots were made using Carbon.