A type-safe and generic dynamic array in C