A collection of demos about how pointers are used, with extensive comments to help explain everything.
I am a Teaching Assistant for a introduction to C++ class, and lots of confusion arises when we begin to use pointers. I created this repository so students can have easy access to useful information about pointers - how they are used, differences between the stack and the heap, things to be aware of / avoid, etc. Even if you aren't a student, you can use this as a reference (pun not intended) if you need some help working with pointers. If you have things to add/change, feel free to submit a pull request.
| Demo | Description |
|---|---|
| Basics | A good starting place if you are new to pointers, or need a refresher on how they work |
| StackVsHeap | Expands upon some of the concepts from Basics; Gives information about how memory allocation works on the stack and the heap, and how pointers intereact with both part of memory |
| Arrays | Introduces the concepts of pointer arithmetic and how to use pointers to create single and multidimentional arrays |
| Classes | Introduces the "->" symbol, and how pointers can be used with classes |
| Functions | Explains what a function pointer is, how to create one, how they are used, and why they are used |
| Smart Pointers | Introduces Smart Pointers, which are classes that encapsulate pointers to assist in memory management. Smart Pointers are useful for helping to clean up memory when they go out of scope |