Learning C with a simple dynamic array