例如int cmp(const void *a,const void *b){return *(int *)b-*(int *)a;}qsort(a,n,sizeof(a[0]),cmp);另外解释一下例子中的CMP例子2:int cmp(edge a,edge b){return a.w<b.w;} sort(e,e+m,cmp); //其中e是结构体数组,结构类型为edge
慕尼黑的夜晚无繁华
海绵宝宝撒
相关分类