Javatpoint Logo
Javatpoint Logo

C++ List pop_back()

C++ List pop_back() function removes the last element from the list and reduces the size of the list by one.

C++ List pop_back()

pop_back() function removes the last element i.e 4

Syntax

Parameter

It does not contain any parameter.

Return value

It does not return any value.

Example

Let's see a simple example

Output:

6,7

In this example, pop_back() function removes the last two elements from the list.





Help Others, Please Share

facebook twitter pinterest