#pragma once struct foobuf { size_t len; size_t offset; float *data; }; int foobuf_init(struct foobuf **, size_t len); float foobuf_read(struct foobuf *buf, size_t offset); void foobuf_write(struct foobuf *buf, float val); int _struct_init(void **, size_t); #define struct_init(ptr) _struct_init((void **)ptr, sizeof(**ptr)) #define array_init(ptr, len) _struct_init((void **)ptr, sizeof(**ptr) * len)