Actually, it does succeed in sorting, and this is perfectly fine code. Array's are nothing more than thinly veiled pointers, so while it is true the function is not technically passing by reference, that would be because it is passing by address instead.
You can just as easily use this code:
As this code:Code:template<typename T> void selectSort(T arr[], int n) {
- ZekeCode:template<typename T> void selectSort(T *arr, int n) {


LinkBack URL
About LinkBacks







Reply With Quote



Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum