Skip to main content

Practice ยท 1 of 3

Create and Destroy

Implement DArray* da_create(int cap) returning a heap-allocated DArray whose data is a heap array of cap ints (size 0), or NULL for cap <= 0 or allocation failure. Implement void da_destroy(DArray *a) freeing data and the struct itself (NULL-safe).

Difficulty: beginner

Back to lesson: Practice: Dynamic Array Build