C++ Vector


Vector is a class which creates a dynamic array allowing insertions and deletions at the back.

Syntax:

vector<object_type> v1; 

Example:

#include<iostream>  
#include<vector>    
using namespace std; 
 
int main()  
{  
    vector<string> v;  
    v.push_back("Welcome To ");  
    v.push_back("Onlinetpoint");
    vector<string>::iterator it=v.begin(); 
    while (it!=v.end())
    {
       cout << *it;
       ++it;
    }  
    return 0;   
}



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.