Home » C++ Vector front() function

C++ Vector front() function

by Online Tutorials Library

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

You may also like