diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 22 |
1 files changed, 21 insertions, 1 deletions
| @@ -7,8 +7,28 @@ | |||
| 7 | #include <error.h> | 7 | #include <error.h> |
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | 9 | ||
| 10 | #include <string.h> | ||
| 11 | #include <stdlib.h> | ||
| 10 | int main() { | 12 | int main() { |
| 11 | error(1, ENOTSUP, "No main file lol"); | 13 | // error(1, ENOTSUP, "No main file lol"); |
| 14 | |||
| 15 | // Testing Arena changes | ||
| 16 | const int DATA[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; | ||
| 17 | |||
| 18 | arena *arena = arena_init(sizeof(DATA)); | ||
| 19 | if(!arena) | ||
| 20 | error(1, errno, "Could not initialize arena"); | ||
| 21 | |||
| 22 | int *nums = arena_alloc(arena, sizeof(DATA)); | ||
| 23 | if(!nums) | ||
| 24 | error(1, errno, "Could not allocate memory"); | ||
| 25 | |||
| 26 | memmove(nums, DATA, sizeof(DATA)); | ||
| 27 | for(unsigned int i = 0; i < STATIC_ARRAY_LEN(DATA); i++) | ||
| 28 | printf("%d ", nums[i]); | ||
| 29 | printf("\n"); | ||
| 30 | |||
| 31 | arena_free(&arena); | ||
| 12 | 32 | ||
| 13 | return 0; | 33 | return 0; |
| 14 | } \ No newline at end of file | 34 | } \ No newline at end of file |
