Time remaining:
I am programming in c++

Computer Science
Tutor: None Selected Time limit: 0 Hours

I have a function (void remove_element(vector<string> vector, int x));.

I want to remove the element of the vector that is at int x.

I do not want to change the arrangement of the elements.

I only want to remove the element and keep everything else same

Dec 10th, 2014

void remove_element ( vector <string> & myvector , int x ) {

myvector.erase ( myvector.begin() + x ) ;

}

If the reference (&) to the vector 'myvector' is not passed to the 'remove_element' function, then the 'x'th element

is removed from the vector only in this function and is not reflected in the caller.

Dec 11th, 2014

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Dec 10th, 2014
...
Dec 10th, 2014
Mar 1st, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer