Selection Sort

Jun 13, 2012 at 10:33am
Dear all,

In the selection sort as in the link below:

http://www.fredosaurus.com/notes-cpp/algorithms/sorting/selectionsort.html

Apparently the array x[] being sorted is changed in the process. So how come in the function title it is declared as int x[] but not int& x[]?

Many thanks.

Regards,
Bosco
Jun 13, 2012 at 10:37am
x is just a pointer to the first element in the array. The first row is completely equivalent to
void selectionSort(int* x, int n) {
Jun 13, 2012 at 10:50am
Topic archived. No new replies allowed.