I have an array of pointers to string:
char *TAB[3] = { "dafafa", "alfkasf", "bafgr" };
I would like to sort characters in in each of those strings.
My compare function:
int cmp(const void *a, const void *b)
{
return *(char *)a - *(char *)b;
}
and while trying qsort on one of these:
qsort(TAB[0], 6, sizeof(char), cmp);
The program doesn't work.
After many efforts I found that the reason of the problem is in delivering TAB[0] to qsort().
Can anyone explain why it doesn't work and how to fix that?