Hi,
I'm trying to sort a structure I've created via qSort however it seems to be be doing what I expect it to.
This is my compare function
int compare(const void *a, const void *b) {
const INPUT *p1 = a;
const INPUT *p2 = b;
return ((p1->startTime) - (p2->startTime));
}
Where INPUT is my structure and startTime is an int within it.
I call qsort by this
qsort(*global,fileNumber,sizeof(global)/fileNumber,compare);
Where global is the variable name of INPUT, fileNumber is how many entries are within the global variable.
From the printf statements I've written it seems to do nothing.
I've initialized at the beginning of my code global like this
INPUT *global[4];
Any ideas on what I've done wrong?
Thanks