--- Dale Kingston <[EMAIL PROTECTED]> wrote: > I asked, cause I simply changed the return 2 and return 1 to 1 and -1 and > it's working fine. So I don't see why I need to allocate an array for it to > work with. ESP an allocated array that isn't freed when it's finished so > with that I've allocated the needed memory for the helps twice havn't i?
Sorry, As I said I was doing too many things at once. You should obviously free the array before the function exits with a free_mem(help_array) before the function exits. That said, you still have to pass qsort an array, not a linked list. I have no idea why your program isn't crashing horribly, but the result of passing a non-array to qsort is undefined. Since you don't know at the point where you call qsort how many helps you have, you have to count them, allocate an array to store the pointers in, and push the linked list into the newly allocated array. The only time you wouldn't need to allocate an array is if your helps are already stored in an array (rather than a linked list). This would not be very flexable however, so the method I'd previously described would be best. ~Kender ===== -----BEGIN GEEK CODE BLOCK----- Version 3.1 GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$ P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@ b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++ ------END GEEK CODE BLOCK------ __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/

