Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

I'm trying to sort a vector full of integers with Quick Sort, there are no errors, but after the sorting process the numbers are still in their original order. Code is here: http://pastebin.com/grxtR1wk Thanks

OpenStudy (anonymous):

I'm guessing you want to write vector<int>& array. When you just write vector<int> array, you're creating a copy of the array every time you call QuickSort.

OpenStudy (espex):

You appear to be only manipulating a copy of your array, your return is just an int. If you want to manipulate the actual array you will need to pass a pointer or put it inside your main where it has direct access to your array.

OpenStudy (anonymous):

Yes that was the problem, and putting an "&" before "array" solved it. I wasn't aware it was that simple. Thanks guys :)

OpenStudy (espex):

Amazing how the little things can thorw ya.. :) Glad you got it working.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!