Mercurial
diff playground/main.c @ 71:75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Sun, 28 Dec 2025 20:34:22 -0800 |
| parents | 342726584be2 |
| children | f07abbcd2ec5 |
line wrap: on
line diff
--- a/playground/main.c Thu Dec 25 20:10:46 2025 -0800 +++ b/playground/main.c Sun Dec 28 20:34:22 2025 -0800 @@ -1,20 +1,33 @@ #include <stdio.h> +#include <stdlib.h> -struct Node { - char *value; - struct Node *left; - struct Node *right; -}; +typedef struct { + float foo; + float bar; +} Values; -void *recurr(struct Node *root, int depth) -{ - if (depth) - return; - root.left = -} +int capacity = 20; int main() { - struct Node root = {} - struct Node **queue = {} + int a; + void *p = malloc(sizeof(Values) + (sizeof(int) * 20)); + int *b = (int *)(p + sizeof(Values)); + Values *c = (Values *)p; + c->foo = 10.0f; + c->bar = 12.0f; + for (int i = 0; i < 20; i++) + b[i] = i; + + for (int i = 0; i < 20; i++) + printf("values is %i\n", b[i]); + + printf("c->foo: %f\n", c->foo); + printf("c->bar: %f\n", c->bar); + + Values *d = (Values *)b - 1; + printf("d->foo: %f\n", d->foo); + printf("d->bar: %f\n", d->bar); + + return 0; }