You're passing a copy of the vector list to fillArray, which goes out of scope as soon as the function returns. Try changing it to a reference:
void fillArray(vector<int> &list, int length) {
// ...
edit: haha, I beat you Ancient Dragon!
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
you need to pass the vector by reference, not by value. like this:
void fillArray(vector<int>& list, int length)
[edit] Sorry Joe, I didn't see your post before I posted mine [/edit]
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Post your updated code (and any errors you receive).
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
you forgot the void function return type
void selectionSort (vector<int>& list, size_t length)
depending on what compiler you are using you may also have to redefine length as size_t instead of int.
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
it doesn't sort because you commented that line out in main(). And what is all that crap at the beginning of every line that you posted? I hope you didn't put that there intentially :eek:
Ancient Dragon
Retired & Loving It
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343