2019-08-19, 05:38 AM
While using spaces is not at all a unique way of splitting strings, it's a good effort. However, there are many ways it can be improved. You don't need to copy the strings around at all, simply inserting a null character will end a string so you can send part, then put the original character back. This method is infinitely extendable so you aren't limited to 2 lines only.
You've also not considered what happens if someone types a very long line with no spaces. Most systems will also opt to split mid word if it is a long word and the lines would otherwise be extremely unbalanced.
You've also not considered what happens if someone types a very long line with no spaces. Most systems will also opt to split mid word if it is a long word and the lines would otherwise be extremely unbalanced.