Ok so i have the following functions that does a recursive merge sort. I need to pass my arrays in by reference since I have many different arrays containing different things. Im comparing lists[index1].get_type() vs lists[index2].get_type() yet when i run this i am getting the same event with the same members. So i know i need to pass by reference using the * but apparently im missing it some wheres so i need some quick help. anyone?
void merge_sort(UTAevent to_sort[], int first, int last){
if ( first < last ){
merge_sort(to_sort, first, (first+last)/2);
merge_sort(to_sort, (first+last)/2 + 1, last );
merge( to_sort, first, ((first+last)/2), ((first+last)/2 + 1), last );
}
}
void merge( UTAevent lists[], int first1, int last1, int first2, int last2){
UTAevent temp[EVENTMAX];
int index, index1, index2;
int num;
index = 0;
index1 = first1;
index2 = first2;
num = last1 - first1 + last2 - first2 + 2;
while ((index1 <= last1) && (index2 <= last2 )){
if ( (lists[index1].get_type()) < (lists[index2].get_type()))
temp[index++] = lists[index1++];
else
temp[index++] = lists[index2++];
}
if ( index1> last1)
move( lists, index2, last2, temp, index);
else
move(lists, index1, last1, temp, index);
move( temp, 0, num-1, lists, first1);
}
void move(UTAevent list1[], int first1, int last1, UTAevent list2[], int first2){
while (first1 <= last1)
list2[first2++] = list1[first1++];
}