summaryrefslogtreecommitdiff
path: root/examples/gevector.c
blob: 93a1960ae60185d0f6b20b32d815ee6374266a7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>

#include <gevector.h>

GEVECTOR_DEF(int, ivec)

int
main(void)
{
	ivec_t *vec = malloc(sizeof(ivec_t));
	ivec_new(vec, 3, 0);

	ivec_push(vec, 42);
	ivec_push(vec, 69);
	ivec_push(vec, 420);
	ivec_insert(vec, 1337, 2);

	for (size_t i = 0; i < vec->len; i++)
		printf("%d\n", ivec_get(vec, i));

	ivec_free(vec);
	free(vec);
}