1 #pragma once 2 3 #include <stddef.h> 4 5 /* 6 * Declaration of struct array is in header because we may want to embed the 7 * structure into another, so we need to know its size 8 */ 9 struct array { 10 void **array; 11 size_t count; 12 size_t total; 13 size_t step; 14 }; 15 16 void array_init(struct array *array, size_t step); 17 int array_append(struct array *array, const void *element); 18 int array_append_unique(struct array *array, const void *element); 19 void array_pop(struct array *array); 20 void array_free_array(struct array *array); 21 void array_sort(struct array *array, int (*cmp)(const void *a, const void *b)); 22 int array_remove_at(struct array *array, unsigned int pos); 23