Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Use std::string to store text. You don't have to keep track of memory and it's easier to access specific elements, such as the last character.
Iterating over all characters is also more convenient:
string str = "hello!";
for(auto& c: str) {
c += 1;
}
cout << str << endl;
And what's the difference between char* and char[]?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question