| ||||||||||
| 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的cmp函数怎么写?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator