Answers for "c++ string size"

C++
36

length of string c++

// string::length
#include <iostream>
#include <string>

int main ()
{
  std::string str ("Test string");
  std::cout << "The size of str is " << str.length() << " bytes.\n";
  return 0;
}
Posted by: Guest on November-18-2019
12

length of string in c++

str.length();
Posted by: Guest on June-04-2020
5

c++ string size

// C++ string size
str.length();
str.size();			// synonym
Posted by: Guest on March-21-2021
2

create a string of length c++

#include <string>
#include <iostream>

int main()
{
    std::string s(21, '*');

    std::cout << s << std::endl;

    return 0;
}
Posted by: Guest on March-11-2021
2

length of a string c++

string str ="hello world"; 
//different ways to find length of a string: 
str.length(); 
str.size();
Posted by: Guest on October-19-2020
0

c++ string size

// string::size
#include <iostream>
#include <string>

int main ()
{
  std::string str ("Test string");
  std::cout << "The size of str is " << str.size() << " bytes.\n";
  return 0;
}
Posted by: Guest on February-03-2021

Browse Popular Code Answers by Language