《C语言函数速查》Q开头的函数
深入了解IT/互联网行业及岗位,请参阅通用IT/互联网岗位招聘计划(最新全岗版)。
深入了解职业晋升及学习路线,请参阅最优职业晋升路线和课程学习指南(最新全栈版)。
内容导航:
- 01、—
函数名: qsort
功 能: 使用快速排序例程进行排序
用 法: void qsort(void *base, int nelem, int width, int (*fcmp)());
程序例:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int sort_function( const void *a, const void *b);
char list[5][4] = { “cat”, “car”, “cab”, “cap”, “can” };
int main(void)
{
int x;
qsort((void *)list, 5, sizeof(list[0]), sort_function);
for (x = 0