Hello,
I've got an array of doubles and wrote a simple comparison function, but when I run, my array remains unsorted. Your help is appreciated.
Also, I don't know much about function pointers, but considering gcc didn't spit out any errors, I think what I wrote was correct.Code:double moment [1001]; ... void *func = &dComp; qsort(moment,1001,sizeof(double),func); ... int dComp(const void *a,const void *b) { if( &a < &b) return -1; else if( &a > &b) return 1; else return 0; }