C++ Vector at()
It gives a reference to an element.
Consider a vector v and k is the position. Syntax would be:
k: k defines the position of element which is to be returned by at() function.
It returns the element of specified position.
The following illustration shows how at() function works
If i=0 :
If i=3 :
Let's see a simple example.
In this example, at() function access the elements of vector .