Dynamic Memory Allocation in C — a practical guide to C dynamic memory allocation with clear examples you can reuse in real projects.
C Programming Tutorial Series (63/102). Prefer one article? Read the complete C programming tutorial.
Short description
Every successful malloc/calloc/realloc needs a matching free path.
Heap checklist
Allocate
Check NULL
Use
Free
Set pointer NULL after free (good habit)