C++ VectorA vector is a sequence container class that implements dynamic array, means size automatically changes when appending elements. A vector stores the elements in contiguous memory locations and allocates the memory as needed at run time. Difference between vector and arrayAn array follows static approach, means its size cannot be changed during run time while vector implements dynamic array means it automatically resizes itself when appending elements. SyntaxConsider a vector 'v1'. Syntax would be: ExampleLet's see a simple example. Output: javaTpoint tutorial In this example, vector class has been used to display the string. C++ Vector Functions
Next TopicVector at() Function
|
Javatpoint provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India