C++ string 是否以‘\0’结尾 讨论

以前在某篇文章中看到,C语言字符串是以'\0'结尾的,可是C++string类型的字符串并非以'\0'结尾。话很少说,直接放代码(Cygwin64环境g++编译器):c++ string b("abc"); cout << b.capacity() << endl; cout << b.size() << endl; if(b[3] == '\0') cout << "yes" << endl
相关文章
相关标签/搜索