Writing memory efficient C structs