How to do it?

The function reads text from words from a file and returns a two-level dynamic array of pointers to lines to lines containing words from the source file, sorted alphabetically. The dimension of the array of lower level pointers is specified, each array of pointers is null limited. The next line is inserted while maintaining order, in the first cycle, an array of first-level pointers is scanned, and in each, an element with index 0 of the second level. If its value is more than new, then insertion into the previous array of lower-level pointers is performed. If an overflow occurs during insertion, the array creates a new array of pointers, into which half of the current pointers are copied.
Break it down into tasks:

1) Create a "two-level dynamic array" of pointers of the appropriate type for storing words
2) Read words from a file
3) Create new lines in your array as necessary
4) Store those words in the appropriate place in your array

I'm not sure what "If its value is more than new, then insertion into the previous array of lower-level pointers is performed" means - this looks like a bad translation from some other language. It sounds as though your code is required to do some kind of dynamic memory management. I assume it makes more sense in the original language.

Topic archived. No new replies allowed.