Javatpoint Logo
Javatpoint Logo

C++ Deque begin()

C++ Deque begin() function returns an iterator pointing to the first element of the deque container. If the container is empty then the returned iterator will be equal to the end().

Syntax

Parameter

It does not contain any parameter.

Return value

It returns an iterator pointing to the first element of the deque.

Example 1

Let's see a simple example

Output:

first element of the deque:1

In this example, begin() function returns an iterator of the first element.

Example 2

Let's see a simple example

In this example, begin() function is incremented by 2. Therefore, begin() function returns an iterator of the third element.


Next TopicC++ Deque



Please Share

facebook twitter google plus pinterest