struct something floattosomething(float f){ struct something * ret = (struct something*)malloc(sizeof(struct something)); ret->type = 3; ret->f = f; return *ret; }