Javatpoint Logo
Javatpoint Logo

C++ Deque push_front()

C++ Deque push_front() function inserts new element in the beginning of the deque container and the size of the container is increased by one.

Syntax

Parameter

val: New value to be added in the beginning.

Return value

It does not return any value.

Example 1

Let's see a simple example

Output:

100 200 300 400 500 

In this example, push_front() function adds new element i.e 100 before the first element 200.

Example 2

Let's see a simple example

Output:

java is a programming language 

In this example, push_front() function adds new string i.e "java" before the first string "is".


Next TopicC++ Deque



Help Others, Please Share

facebook twitter pinterest