struct vector { int size; float data[0]; }; ... int howmuchdata = 8; ... struct vector *v = calloc(1, sizeof(*v) + (howmuchdata * sizeof(float)));