Practice · 2 of 3
Push with Grow
CHALLENGE
Difficulty: beginner+25 XP
Given int da_push(DArray *a, int v) exists in spirit, implement int da_push2(DArray *a, int v): append v; when size == cap, DOUBLE cap (cap 0 becomes 4) via realloc; return 1 on success, 0 on realloc failure (leaving the array intact).
Press Submit to check your solution.
Back to lesson: Practice: Dynamic Array Build