cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Selection Sort
Selection Sort
Jun 13, 2012 at 10:33am UTC
boscomanilow128
(56)
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 UTC
Peter87
(11234)
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 UTC
kbw
(9488)
http://www.cplusplus.com/forum/general/70081/#msg373940
Topic archived. No new replies allowed.