Answer the question
In order to leave comments, you need to log in
Does a std::string contain a null-terminated string (i.e. '\0')?
In C++ a string is a vector == pointer to start and length. But will there be a closing 0?
class String{
private:
char * str; // pointer to string
int len; // line length
static int num_strings; // number of objects
static const int CINLIM = 80; // input limit for cin
}
Answer the question
In order to leave comments, you need to log in
Prior to C++11, strings may not contain a null terminator, but starting from C++11, they must. The data() method returns the same as c_str().
https://en.cppreference.com/w/cpp/string/basic_str...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question