C++ – Pointers

I’ve been learning C++ for the last month and a half. I do have some basic programming knowledge (studying Javascript, as well, for the last 8 months or so). Also, in college (10 years ago!) I took a C++ course, and I do recall many of the basics. However, I’ve learned that the language has gone through a few significant updates since then.

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


Pointer Arithmetic


Pointers and const


Pointers to pointers


Void Pointers


Null Pointers


Pointers to Functions


The screenshots were made using Carbon.