Why doesn't the code below sort the month names? Base address is correct, number of elements is correct, size of each element is correct, cmp function is correct. gcc -W -Wall -ansi -pedantic doesn't complain a peep.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int by_name(const void *a, const void *b) {
fprintf(stderr, "%p %p\n", a, b);
return strcmp((const char *)a, (const char *)b);
}
int main(void) {
char *months[] = {
"January",
"Februar",
"March",
"April",
"May",
"June",
"July",
"August",
"September", …Run Code Online (Sandbox Code Playgroud)