Tag: memory
All the articles with the tag "memory".
-
Shallow Copy vs Deep Copy in C++ (With Examples)
Shallow copy vs deep copy in C++: what each one copies, why copying a raw pointer can crash your program, and how to write a deep copy or avoid needing one.
-
Dynamic Arrays in C++: How to Create an Array With a Runtime Size
Learn how to create a dynamic array in C++ with new and delete[], why sizeof breaks on it, how to resize one, and why std::vector is the safer choice.
-
Union in C++: What It Is and When You Should Use One
Learn what a union is in C++, how it shares one block of memory between members, how it differs from a struct, and when a tagged union is the safe choice.
-
How to Use Pointers in C++: A Complete Beginner's Guide
Updated:Learn how to use pointers in C++ with clear mental models and real code examples. Understand addresses, dereferencing, and why pointers matter, step by step.