Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:谁能帮看下,qsort()对指针排序让人心碎!

Posted by ldf00000 at 2011-10-18 19:21:15 on Problem 1639
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator