Javatpoint Logo
Javatpoint Logo

C++ String reserve()

This function requests a change in capacity.


Consider a string str and l is planned length of the string. Its syntax would be:


l is the planned length for the string

Note: capacity of the string can be greater than or equal to 'l'.

Return value

It does not return any value.


Let's see the simple example.


Capacity is 27
Now,capacity is : 54

In this example, we observe that how capacity of the string varies using reserve() function.

Next TopicC++ Strings

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA