| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | qsort-ing a struct |
JD> function should look like this:
JD> int cmp(const void *a, const void *b)
JD> {
JD> struct foo *struct_a = (struct foo*)a,
JD> *struct_b = (struct foo*)b;
JD> }
Well, not quite.
int cmp(const void* a, const void* b)
{
const struct foo* left = (const struct foo*)a;
const struct foo* right = (const struct foo*)b;
// remember to compare these. :-)
// return 0 for left > right
}
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102) |
|
| SOURCE: echomail via exec-pc | |
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™.