#ifndef __VECTOR_H__ #define __VECTOR_H__ #define vector(type) \ struct \ { \ type *items; \ size_t count; \ } #define vector_init(v) \ do \ { \ (v).items = 0; \ (v).count = 0; \ } while (0); #define vector_append(type, v, i) \ do \ { \ (v).count++; \ (v).items = (type *)realloc((v).items, sizeof(type) * (v).count); \ (v).items[(v).count - 1] = i; \ } while (0); #endif // __VECTOR_H__