Different ways to iterate over C++ Vector

A vector is a data structure for maintaining a set of elements having a specific data type.
Here, we’ll learn about various ways to iterate over a C++ Vector. (Some of the following ways could also be used with other C++ containers like list, queue, map etc.)

C Revision (Quick Notes)

Importance of main: main() function is the first function to be executed in the program. All the remaining functions in the program are called from main().

C++ Standard Template Library (STL) – [Pair and Tuple]

Pair in C++ STL is used to combine two values having different or same data types. It stores two different values as a single element. Tuple unlike pair can be used to combine two or more than two values having different or same data types.

C++ Standard Template Library (STL) – [Vector]

A vector is a data structure for maintaining a set of elements having a specific data type. Vectors can be considered as arrays having dynamic size. Just like arrays, vectors also store its elements in a contiguous storage locations.