TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-11-24 13:55:38
subject: Bloody C

PE> You're not, you're trying to sort char *list[500]. To do that,
PE> you need: 

PE> return(strcmp(*(char **)a, *(char **)b));

BL> WHAAATT!!????? What the fuck does THAT mean?

BL> We're typcasting "a" as a pointer to a character pointer, and then
BL> dereferencing it? JEESUZ!! I give up!! Are we passing the data behind
BL> the pointer-pointer, or the pointer behind the data-pointer?

Well, qsort will give you the address of an array element.  The array
elements call have char * in them, so the ADDRESS of that, is char **. So
qsort is giving you a char **.  But you're not after the address of the
array element, you're after the data that is stored in that element.  So
you need to dereference it with *.  BFN.  Paul. 
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.