So, I have an array of string (name input), and I want to sort that array. I use something like this
int stringLen = sizeof(input)/sizeof(char *); qsort(input, stringLen, sizeof(char *), myCompare); However I get this confusing error:
error: invalid conversion from 'int (*)(const char*, const char*)' to '__compar_fn_t {aka int (*)(const void*, const void*)}' [-fpermissive]In file included from srot13u.c:5:0: /usr/include/stdlib.h:761:13: error: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)' [-fpermissive]
myCompare? Is itint myCompare(const char *, const char *)? Because the error message suggests it expectsmyCompareto look likeint myCompare(const void *, const void *).