If you must use C, you should probably use a general-purpose library like glib to provide the necessary functionality for any sensible program to avoid you having to reinvent the wheel.

Alternatively learn C++ and use the STL, which is my preferred tack.