Javatpoint Logo
Javatpoint Logo

C++ Vector front()

It gives a reference to the first element of vector.

cpp Vector front() function

Syntax

Consider a vector.Syntax would be:

Parameter

This function does not contain any parameter.

Return value

This function returns the first element of the vector.

Example 1

Let's see a simple example.

Output:

java

In this example, front() function displays the first element of language object.

Next TopicC++ Vector





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA