aboutsummaryrefslogtreecommitdiff
path: root/example.c
blob: bddf398879c5cdcaf21f99628f5dbead0f54ac50 (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
25
26
27
28
29
#include "Array.h"
#include "BumpAlloc.h"
#include "GlobalArena.h"
#include "String.h"
#include <stdio.h>

int
main() {
    g_arena = B_create(KiB(4));

    int *nums = AG_new(sizeof(int), 8);
    for (int i = 10; i < 20; ++i) {
        A_push(nums, &i);
    }

    printf("%lu/%lu |", A_count(nums), A_length(nums));
    for (int i = 0; i < A_count(nums); ++i)
        printf(" %d", nums[i]);
    printf("\n");

    String s = SG_concat("Hello", " ", "World", "!", NULL);
    printf("%s\n", s);

    String s1 = SG_printf("%s #%d\n", s, 5);
    printf("%s\n", s1);

    B_destroy(g_arena);
    return 0;
}