Javatpoint Logo
Javatpoint Logo

C++ List push_back()

C++ List push_back() inserts a new element at the end of the list and the size of the list container increases by one.

C++ List push_back()

push_back() function inserts element 5 at the end.

Syntax

Suppose a element is 'x':

Parameter

x: It is the value to be inserted at the end.

Return value

It does not return any value.

Example 1

Let's see a simple example

Output:

C  C++  .Net java PHP

In this example, push_back() function inserts two strings i.e java and PHP at the end of the list.

Example 2

Let's see a simple example

Output:

6,7,8,9,10,11




Please Share

facebook twitter google plus pinterest