Will the below string contain the null terminator '\0'?
std::string temp = "hello whats up";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, but if you say
temp.c_str()a null terminator will be included in the return from this method.It’s also worth saying that you can include a null character in a string just like any other character.
prints
5 5and not
5 1as you might expect if null characters had a special meaning for strings.