Don't use this, use siArray
in my single header repository sili.h. Same thing except 1000000x times better with more features and what not.
A very simple header-only implementation of a dynamic array (vector) in C with all the required features for a dynamic array.
- Simple to use.
- Portable as it's header-only and written in C89.
- Small in size.
- Very simple and basic source code, no overcomplications.
To use it you must define VECTOR_IMPLEMENTATION
once before including vector.h
.
#define VECTOR_IMPLEMENTATION
#include <vector.h>
Explanations on what each function does are in vector.h. There's also a provided example here, utilizing all of the features of the library.
Original implementation is by this article
Majority of the source code credit goes to that article. I only added a few new features and improvements to the code, and turned it into a small and simple portable header file.