TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-12-02 22:38:46
subject: posix

BL>   qsort(list, n, 80, sort);
PM>                 ^^^^

PM> If you're trying to sort using pointers, defining the element length as 80
PM> is wrong. You need to define it as the length of a pointer:

PM> qsort(list, n, sizeof(list[0]), sort);

Which is a better solution that sizeof(char *), because you don't need to
have the data type of list[0] coded in multiple places.

Personally I would use "sizeof list[0]" rather than
"sizeof(list[0])", for the same reason that I don't go x = (3) *
(4).  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™.