Not sure what was happening. It was just cutting my post off halfway through my first snippet when I tried. Anyway, here's the qsort() call and the comparator I give it:
Code:
void sort_dict(){
qsort(words, dicSize, sizeof(char)*30, cstring_cmp);
}
int cstring_cmp(const void *a, const void *b) {
const char **ia = (const char **)a;
const char **ib = (const char **)b;
return strcmp(*ia, *ib);
}
And the array declaration and allocation:
Code:
char **words;
words = (char**)malloc(sizeof(char*)*dicSize);
for(i = 0; i<dicSize; i++){
words[i] = (char*)malloc(sizeof(char)*30);
}