Application of seek length string object sizeof

#include
using namespace std;
int main()
{
string a(“Hello”);
int b=a.length();
cout<<sizeof(a);
cout<<" "<<b;
return 0;
}

Direct () Find the object space length string object should be occupied by seeking sizeof, less than the length of the seek
Here Insert Picture Description

Released three original articles · won praise 0 · Views 37

Guess you like

Origin blog.csdn.net/qq_45788961/article/details/103939364