c - qsort an array of strings, compare -
I'm trying to find out the use of qsort with an array of strings, my code looks like this < / P> However, I get "access violation # 0x # # ### .." every time and I do not know whether anyone can see my problem? EDIT: Thanks for the wonderful help you guys are always best. You are not casting your plus Four words [500] [256]; Int numOfWords; // It is calculated from the intert wordlist above () {int length = cecoff (word) / size (four *); Cursure (word, length, sizeoff (four *), compare); } Compare Int (Cont Woed * A, Constwid * B) {const char * pa = * (const char **) a; Const char * pb = * (const char **) b; Return SRCMP (PA, PB); }
const void * properly, such a To do this, use instead:
const char * pa = (const char *) a; Const char * pb = (const char *) b;
should be above the
comparison
sortWordList () as you are using it in
sortWordList () Code>.
Comments
Post a Comment