Growing Pains: realloc and Automatic Capacity Management
Post 2 of the Dynamic Arrays in C series · Full source code Where We Left Off In Post 1 we built an array that does three things: allocate a fixed buffer, push integers into it, and free everything when we’re done. It works, until it doesn’t. The moment the user pushes one element more than the initial capacity allows, array_push returns -1 and refuses to cooperate. The array is full and there’s nothing we can do about it. ...