view 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 source

#include <stdio.h>
#include <stdlib.h>

typedef struct {
  float foo;
  float bar;
} Values;

int capacity = 20;

int main()
{
  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;
}