int length = strlen(src); char *structSpace = malloc(sizeof(String) + length + 1); String *string = (String*) structSpace; int *string = (int*) s
The C FAQ list is an invaluable resource: Why does some code carefully cast the values returned by malloc to the pointer type being allocated?.