| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:谁能帮看下,qsort()对指针排序让人心碎!In Reply To:谁能帮看下,qsort()对指针排序让人心碎! Posted by:orlando22 at 2009-04-18 13:52:31 cmp应该改为
int cmp(const void* p1, const void* p2){
return (*(Pedge*)p2)->value - (*(Pedge*)p1)->value;
}
//cmp函数在正的时候交换,负的时候不交换,零的时候未定义。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator