| ▲ | flohofwoe 9 hours ago | |
The most idiomatic and elegant 'dynamic array in C' solution is stb_ds.h, it's as simple as that :) The 'public handle' is a pointer to the array elements so it has the same semantics as a regular C array, the meta-data (capacity and length) are stored directly in front of the array items. Growing the array has the same behaviour as realloc (e.g. you may get a new pointer back). | ||