How to deal with c-string pointers [closed]

You are not appending characters to the array, nor are you appending pointers to the pointer array.

Here are some steps you will need to perform:
1. Maintain an index or pointer to the next available location in the “sentences” array.
2. After reading the string from the file file, copy its contents to the next available location in the “sentences” array. See std::string::c_str() or std::string::data() to convert from string to “char *”.
3. Maintain a pointer or index to the next available location in the pointers array.
4. Copy the sentences pointer to the next available location in the pointers array.
5. Advance the sentences pointer by the length of the string.
6. Advance the pointers pointer by one.

Code not supplied, as that will defeat the purpose of the assignment.

Leave a Comment