- 1
Length of the string
3 Answers
+ 2
string a="hi there";
cout<< a.length();
//output 8
+ 2
You can use .length() or .size().
cout << âhiâ.length();
And
cout << âhiâ.size();
Will both output 2. I prefer size() because it requires less typing and seems to do the same thing.
+ 1
Can you specify with more detail please.