几个函数介绍:
1、 void *memset (void *s, int c, size_t n); 在string.h 中,表示将数组 s 的前n个字节设置为字符c
代码:
#include
#include
#include
#define MAX 101
int compare(const void *src,const void *des)
{
int a=*(unsigned int*)src,b=*(unsigned int*)des;
if(a == b)
return 0;
else
return a>b?1:-1;
}
int main()
{
int i=0,count=0;
unsigned int num[MAX],flag[MAX]={0};
memset(num,0xff,sizeof(num));
while(scanf("%d",&num[i]) != EOF)
{
i++;
getchar();
}
count=i;
qsort(num,count,sizeof(int),compare);
for(i=0;i