I\'m starting to use strings in place of character arrays and am encountering an error when I change one of my character arrays defined with a size of 5 to a string. The err
newWord[k]
The size of the newWord string is zero. The behavior of indexing beyond the end of a std::string is not defined.
newWord
std::string
You may need to resize the string, thus:
newWord.resize(5);