While trying to perform insertion sort using vectors in C++, I discovered that when I used, it didn't perform the function:
void ins_sort(vector<int> v){
//function body
}
Whereas when I did the following, it worked:
void ins_sort(vector<int>& v){
//function body
}
Can someone please explain why?