Home » C++ Vector end() function

C++ Vector end() function

by Online Tutorials Library

C++ Vector end()

This function returns an iterator referring to the past-last-element in the vector container.

cpp vector end()

Syntax

Consider a vector v. Syntax would be:

Parameter

It does not contain any parameter.

Return value

It returns an iterator following the last element.

Example 1

Let’s see a simple example.

Output:

10 20 20 40  

In this example, elements of the vector have been iterated using begin() and end() function.

Example 2

Let’s see another simple example.

Output:

Welcome to TutorAspire 

In this example, strings of vector have been iterated using begin() and end() function.

Next TopicC++ Vector

You may also like