I have a bunch of sort methods in a class:
typedef int DataType;
void bubbleSort(DataType theArray[], int n);
void insertionSort(DataType theArray[], int n);
void mergesort(DataType theArray[], int first, int last);
void quicksort(DataType theArray[], int first, int last, char * pivot_type);
void selectionSort(DataType theArray[], int n);
In my main program I am trying to pass a dynamically allocated array to one of these methods:
a.bubbleSort(array, index);
When I output my array, it is not sorted. Should I have passed the array by reference?