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的cmp函数怎么写?

Posted by bluetiger at 2006-01-24 18:09:29
In Reply To:请教一下二维数组qsort的cmp函数怎么写? Posted by:bluetiger at 2006-01-24 10:36:04
> 请教一下二维数组qsort的cmp函数怎么写?
> 例如
> 2 5
> 3 6
> 4 3
> 2 1
> 按第二列用qsort排序
> 谢谢!
我自己回答吧
   
int cmp(const void *a,const void *b)
{
    return *((int*)b+1)-*((int*)a+1);
}    

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