Null character

Character strings in C++ are automatically terminated by null character. Explain how this feature helps in string manipulations.
We aren't here to do your homework for you.
Its not my homework. I am way past getting homework stage
Then you shouldn't be asking this question.
This feature allows to determine the actual size of a string.
It doesn't help, C++ strings would be manipulated just fine without that extra character. It helps the code that expects a C string to work, given a pointer to a character in a C++ string.
@Cubbi
The original post starts with "Character strings in C++..." Character strings and C++ class std::string are different things IMO.
Its not my homework. I am way past getting homework stage

Really? Because it's worded exactly like a question in a homework assignment, or an exam, or a test.
What 'manipulations' you talking about?
@SameerThigale - Are you asking Cubbi? Please use @Cubbi if you're not responding to the OP.

As Cubbi implied, std::string keeps track of of how long a string is, so the trailing null character is not required. Any operation on (manipulation of) std::string objects implicitly knows how long each string object is. This is not true of C character strings.


I am mostly pointing out the ambiguity in the question: both C++ strings and string literals are "automatically terminated by null character", and both hold strings of characters.
Topic archived. No new replies allowed.