Javatpoint Logo
Javatpoint Logo

C++ Vector pop_back()

It deletes the last element and reduces the size of the vector by one.


Consider a vector v.Syntax would be:


It does not contain any parameter.

Return value

It does not return any value.

The following illustration show how pop_back() function works :

cpp Vector pop_back()

This illustration shows how last element of the vector is deleted using pop_back() function.


Let's see a simple example.


Initial string is :welcome to javaTpoint tutorial 
After deleting last string, string is :welcome to javaTpoint

In this example, last string is being removed using pop_back() function.

Next TopicC++ Vector

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA