C++ List push_front()

C++ List push_front() function adds a new element in the beginning of the list. Therefore, increasing the size of the list by one.

C++ List push_front()

push_front(0) function adds 0 element in the beginning.

Syntax

Suppose an element is 'x':

Parameter

x: It is the value to be inserted in the beginning of the list.

Return value

It does not return any value.

Example

Let's see a simple example

Output:

10,20,30,40,50

In this example, push_front() function inserts the element '10' in the beginning of the list.





Latest Courses