Practice · 3 of 4
Grow and Preserve
CHALLENGE
Difficulty: beginner+25 XP
A dynamic array grows by DOUBLING when full: implement int* grow(int *old, int old_cap) returning a new block of 2*old_cap ints whose first old_cap elements equal the old ones. Free nothing — the CALLER still owns old. Return NULL on failure.
Press Submit to check your solution.
Back to lesson: Practice: Allocation Workbench