Practice · 3 of 4
Doubling Growth Policy
CHALLENGE
Difficulty: advanced+25 XP
Implement a growable vector with an explicit growth contract:
``c
int vec_push(int **buf, size_t *len, size_t *cap, int v);
``
Starts at capacity 1; when full, the capacity *doubles*; returns 0 on success, -1 if allocation fails (leave everything unchanged then).
Press Submit to check your solution.
Back to lesson: Practice: Allocator Engineering Drills