diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gevector.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/gevector.c b/examples/gevector.c index df6212e..93a1960 100644 --- a/examples/gevector.c +++ b/examples/gevector.c @@ -9,19 +9,16 @@ int main(void) { ivec_t *vec = malloc(sizeof(ivec_t)); - ivec_new(vec, 2, 0); + ivec_new(vec, 3, 0); ivec_push(vec, 42); ivec_push(vec, 69); ivec_push(vec, 420); ivec_insert(vec, 1337, 2); - GEVECTOR_FOREACH(int, num, *vec) - printf("%d\n", num); + for (size_t i = 0; i < vec->len; i++) + printf("%d\n", ivec_get(vec, i)); - GEVECTOR_ENUMERATE(int, i, num, *vec) - printf("vec->data[%zu] == %d\n", i, num); - - free(vec->data); + ivec_free(vec); free(vec); } |