C++ String max_size
This function calculates the maximum potential size that the string can achieve based on the current system constraints.
Syntax
Consider a string str. Syntax would be:
Example
str.max_size();
Parameters
It does not contain any parameter.
Return value
This function calculates and returns the maximum achievable length of a given string.
Example 1
Let's see the simple example.
Example
#include<iostream>
using namespace std;
int main()
{
string str = "Hello world";
cout<<"String is :" <<str<<'\n';
cout<<"Maximum size of the string is :"<<str.max_size();
return 0;
}