Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 501 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 501 Bytes

vec

A silly, generic, vector for C. Please read the documentation!

#define TYPE int
#include "vec.h"
#undef TYPE

Example

#define TYPE int
#include "vec.h"
#undef TYPE

int main(void) {
	vec_int_t *v = vec_int_from((int[]) {3, 1, 4, 1, 5}, 5);

	assert(vec_int_contains(v, 1));
	assert(!vec_int_contains(v, 9));

	vec_int_push(v, 9);

	assert(vec_int_size(v) == 6);
	assert(vec_int_get(v, 5) == 9);
	assert(vec_int_contains(v, 9));

	vec_int_delete(v);
}