Capacity string c++ code example
Example: 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
*/