int buf[100];
C++用法
sort(buf, buf + 100);
sort(buf, buf + 100, cmp); //数组起始地址,数组结束地址
bool cmp(int x, int y){
return x > y;
}
C语言用法
qsort(buf, 100, sizeof(int), cmp); //数组起始地址,元素个数,元素大小,
int cmp(const void* a, const void* b){
return (int)a - (int)b;
}