This assignment builds a dynamic game inventory system to practice manual memory management using malloc, calloc, realloc, and free.
memory_manager.c- Assignment file with TODO sections to completeREADME.md- This file
Complete all TODO sections in memory_manager.c:
- Part 1: Create Inventory - Allocate arrays using malloc
- Part 2: Expand Inventory - Grow arrays using realloc
- Part 3: Fix Memory Leaks - Add missing free() calls
- Part 4: Safe Pointer Handling - Handle pointers after freeing
Mac/Linux:
gcc memory_manager.c -o memory_manager
./memory_managerWindows:
gcc memory_manager.c -o memory_manager.exe
memory_manager.exeYour completed program should produce output showing:
- Part 1: Starting inventory created and freed
- Part 2: Inventory expanded from 3 to 6 items
- Part 3: Item pickups without memory leaks
- Part 4: Safe pointer handling after freeing
Submit:
- GitHub repository URL with your completed
memory_manager.c - Reflection document (
reflection.txtorreflection.md) with 500-600 words