怎样编写0000000-999999的排序程序
很重要,谢谢,
程序代码:
#include <stdio.h> #include <stdlib.h> int comp( const void * p, const void * q) { return ( * ( unsigned long long * ) p - * ( unsigned long long * ) q) ; } int main() { unsigned long long i,j=0; unsigned long long *p = (unsigned long long *)malloc(1000000*sizeof(unsigned long long)); printf("dd\n"); for (i = 999999;i>0 ;i-- ) p[j++]=i; p[j++]=i; printf("dd1\n"); qsort ( p, 1000000, sizeof ( unsigned long long ) , comp) ; free(p); }不仅可以排0000000-999999
最高可以排:0-9223372036854775807的数字