by skatenerd · 14y ago · 0 comments
http://www.cs.usfca.edu/~wolber/SoftwareDev/C/CStructs.htm
Particularly this part: "// automatic allocation, all fields placed on stack"
RString *s = malloc(sizeof(RString) + length); /* allocate 'length' bytes extra memory past the end of 's' */
s->data = s + 1; /* to the extra memory past the start of the string struct */ s = realloc(s, sizeof(RString));