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




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA