Memory and Pointers
Articles covering pointers, references, dynamic memory management, and addressing in C++.
Memory and Pointers
The low-level power of C++: addressing, pointers and references; stack vs. heap; and dynamic memory management.
Explore the risks of new/delete, safe patterns, and techniques to prevent memory leaks.
Goal: Apply addressing and dynamic memory correctly to write safe, bug-free C++ code.
TL;DR
- Pointers & references:
int* p,int& r,nullptr. - Dynamic memory:
new/delete,new[]/delete[]. - Arrays & pointer arithmetic:
*(p + i). - Habits/tools: RAII; stepping stone to
std::unique_ptr.
Addresses and Memory Basics in C++
Learn the basics of addresses and memory in C++, including memory layout, variable addresses, and how data is stored.
References vs Pointers in C++
Learn the differences between references and pointers in C++, including use cases, advantages, and memory management.
Passing Parameters to Functions via Pointers in C++
Learn how to pass parameters to functions via pointers in C++, including address passing, memory access, and practical examples.
Relationship Between Arrays and Pointers in C++
Learn the relationship between arrays and pointers in C++, including memory layout, pointer arithmetic, and array access.
Dynamic Memory Management in C++: new and delete
Learn dynamic memory management in C++ using new and delete to allocate, release, and manage memory safely.
Memory Leaks and Analysis with Valgrind in C++
Learn how to detect memory leaks in C++ and analyze applications with Valgrind to improve stability and memory usage.
Multidimensional Arrays and Pointer Usage in C++
Learn multidimensional arrays and pointer usage in C++, including memory layout, indexing, and pointer arithmetic with examples.
Introduction to Smart Pointers in C++
Learn smart pointers in C++, including unique_ptr, shared_ptr, and weak_ptr for safe memory management and modern C++ development.