Answers for "Capacity string c++"

C++
0

Capacity string c++

#include <iostream>
#include <string>
using namespace std;
main () {
  string str ("Test string");
  cout << "size: " << str.size() << "\n";
  cout << "length: " << str.length() << "\n";
  cout << "capacity: " << str.capacity() << "\n";
  cout << "max_size: " << str.max_size() << "\n";
}
/*
size: 11
length: 11
capacity: 15
max_size: 429496729
*/
Posted by: Guest on April-01-2021

Browse Popular Code Answers by Language