Okay... I can get the following bubble sort algorithm working perfectly from within main, but since it's used 3 times I'm trying to give the sort its own function.
This just keeps on crashing (I know its the strcmp line) and I've tried every combination of '*'s and '&'s I can think of... any ideas?
void sort_list(char **list, int no_of_words) {
char *temp_pointer;
int i=0, compare=0;
for (i=0;i<no_of_words;i++) {
compare=strcmp(list[i]), list[i+1]);
if (compare > 0) {
temp_pointer=list[i+1];
list[i+1]=list[i];
list[i]=temp_pointer;
}
}
}
P.S. list is an array of pointers to strings declared in main as "char *list[1000]"
Thanks...