I'm trying to set up a structure within a structure, but there's also two dynamic arrays inside:
that's a structure (Doc) with a dynamic structure inside (Sentence *sentences) with a dynamic array inside that (char **words)Code:struct Sentence { int numwords; char **words; }; struct Document { int numLines; Sentence *sentences; } Doc;
The problem is I can't seem to access the char **words portion of the array.
I've set up:
However, I can't seem to be able to figure how to dynamically allocate memory for **words so that it becomes an array of pointers.Code:int len=0; Doc.sentences = new Sentence[len];