qsortsort排序.docVIP

  • 6
  • 0
  • 约1.05万字
  • 约 13页
  • 2017-03-25 发布于四川
  • 举报
qsortsort排序

C语言标准库函数 qsort详解 qsort包含在stdlib.h头文件中,此函数根据你给的比较条件进行快速排序,通过指针移动实现排序。排序之后的结果仍然放在原数组中。使用qsort函数必须自己写一个比较函数。 函数原型: void qsort ( void * base, size_t num, size_t size, int ( * comparator ) ( const void *, const void * ) ); 指向任意数据类型的指针都可以转换为void*类型 用法以及参数说明: Sorts the num elements of the array pointed by base, each element size bytes long, using the comparator function to determine the order. The sorting algorithm used by this function compares pairs of values by calling the specified comparator function with two pointers to elements of the array. The function does not return any

文档评论(0)

1亿VIP精品文档

相关文档