get string size c++ code example
Example 1: length of string in c++
str.length();
Example 2: c++ string size
// C++ string size
str.length();
str.size(); // synonym
Example 3: create a string of length c++
#include <string>
#include <iostream>
int main()
{
std::string s(21, '*');
std::cout << s << std::endl;
return 0;
}