Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

inserting at start in vector c++

// Inserting at start
vector_name.insert(vector_name.begin(), element_to_be_inserted);

// Inserting after xth element
vector_name.insert(vector_name.begin()+(x-1), element_to_be_inserted);

// Inserting at last
vector_name.push_back(element_to_be_inserted);
 
PREVIOUS NEXT
Tagged: #inserting #start #vector
ADD COMMENT
Topic
Name
8+4 =