- 1

Length of the string

13th Feb 2018, 6:28 AM
Muhammad Ashik
Muhammad Ashik - avatar
3 Respostas
+ 2
string a="hi there"; cout<< a.length(); //output 8
13th Feb 2018, 6:47 AM
‎ ‏‏‎Anonymous Guy
+ 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.
13th Feb 2018, 11:04 AM
Jacob Pembleton
Jacob Pembleton - avatar
+ 1
Can you specify with more detail please.
13th Feb 2018, 6:29 AM
Uttam
Uttam - avatar