From c6c5d3cf467dd4f2293b6fe87c242fcb65f4e810 Mon Sep 17 00:00:00 2001 From: Kaehvaman Date: Sun, 29 Dec 2024 21:17:00 +0400 Subject: [PATCH] edit memory_arena test.c --- memory_arena/src/{main.c => test.c} | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) rename memory_arena/src/{main.c => test.c} (64%) diff --git a/memory_arena/src/main.c b/memory_arena/src/test.c similarity index 64% rename from memory_arena/src/main.c rename to memory_arena/src/test.c index 41092c2..974dc23 100644 --- a/memory_arena/src/main.c +++ b/memory_arena/src/test.c @@ -8,28 +8,26 @@ int main() { - Arena arena = ArenaInit(1024 * 1024); + Arena arena = ArenaInit(1024 * 1024 * 1024); char* str1 = ArenaAllocAligned(&arena, 5, sizeof(char)); strcpy(str1, "Hell"); printf("%s\n", str1); - int* int2 = ArenaAllocAligned(&arena, 2 * sizeof(int), sizeof(int)); int2[0] = 123; int2[1] = 789; printf("%d %d\n\n", int2[0], int2[1]); for (int i = 0; i < 16; i++) { - printf("%d) %d\n", i, *((char*)(arena.buffer) + i)); + printf("%2d) %d\n", i, *((char*)(arena.buffer) + i)); + } + + if (scanf("%s", str1)) { + ArenaDestroy(&arena); } scanf("%s", str1); - /*char* str3 = ArenaAllocAligned(&arena, 8, sizeof(char)); - strcpy(str3, "ByeBye!!"); - printf("%s", str3);*/ - - return 0; } \ No newline at end of file