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?

No need to pass references to arrays. In actual fact a pointer to a 1st element of an array passed. Array contents never copied when passed as argument.

What for all these ordinar functions are collected in a class?

Thanks for the reply. This is an assignment and jsut the way they wanted it done.

If you can successfully output the contents of the array before passing it to bubblesort, then within bubblesort() you could try outputting the array before trying to sort it to be sure it has been successfully passed to the function. If so then it seems liklely that the sorting problem is with how you have written the bubblesort function as opposed to not getting the information to the function.

I tried what you suggested and the array is not printing out. So that would mean that the bubbleSort function is never being called. What I was doing wrong was:

if(argv[3] == "bubble")

instead of

if(strcmp(argv[3], "bubble") == 0)

Thanks for the help!