| ||||||||||
| 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 | |||||||||
下面是QSORT 为什么 在C++ 会出错的。。。。。。等待回答In Reply To:const void * 有什么用!! Posted by:noneid at 2005-10-19 20:02:33 #include <stdio.h>
#include "string.h"
#include "stdlib.h"
int sortfun(const void *a,const void *b)
{
return (strcmp(a,b));
}
int main()
{
int i;
char a[5][5]={"ao","home","let","bone","xie"};
qsort((void*)(a),5,sizeof(a[0]),sortfun);
for(i=0;i<5;i++)
printf("%s\n",a[i]);
getchar();
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator