View Single Post
rcgldr is offline
Jan12-12, 09:14 PM
HW Helper
P: 6,925
You could create a typedef for the arraytype:

#typedef ARRAYTYPE double


#typedef ARRAYTYPE int

Then use arraytype instead of int or double:

void sSort(ARRAYTYPE x[], int n){...}

Since this is C++, you could also duplicate sSort() to create one that sorts integers:

void sSort(int x[], int n){...}

You can leave both versions of sSort() in your program. as C++ will treat them as separate functions since their input parameters are different.