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

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Dec 10th, 2014
...
Dec 10th, 2014
May 25th, 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