C++ Vector operator[]()This function is used to access a specified element. SyntaxConsider a vector 'v' and position 'pos'. Syntax would be: Parameterpos: It defines the position of the element. Return valueIt returns the element of specified location. Example 1Let's see a simple example. Output: C C++ java In this example,each element is accessd using operator[]() function. Example 2Let's see simple example Output: 1 2 3 4 5 In this example, each element of vector v is accessed using operator[] () function. Next TopicC++ Vector |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India