摘要: C 自带了一个排序函数qsort, 使用时要定义一个compare方法。下面是一个例子:/* qsort example */#include <stdio.h> /* printf */#include <stdlib.h> /* qsort */int values[] = { 40, 10, 100, 90, 20, 25 };int compare (const void * a, const void * b){ return ( *(int*)a - *(int*)b );}int main (){ int n; qsort (values, 6, size 阅读全文
posted @ 2013-06-05 17:38 菜鸟的世界 阅读(6037) 评论(0) 推荐(0) 编辑