C语言函数集(十五)
2013-11-12 15:30
281 查看
函数名: 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; x < 5; x++) printf("%s\n", list[x]); return 0; } int sort_function( const void *a, const void *b) { return( strcmp(a,b) ); }
相关文章推荐
- Redis学习记录之命令GEO(十五)
- javaweb学习总结(十五)——JSP基础语法
- Redis教程(十五):C语言连接操作代码实例
- 设计模式 ( 十五 ) 中介者模式Mediator(对象行为型)
- CSS学习(十五)-CSS颜色模式、CSS颜色透明度
- ABP源码分析十五:ABP中的实用扩展方法
- spark源码阅读(十五)--securityManager
- Oracle笔记(十五) 数据库备份
- 十五 安装第三方模块
- Metal 着色语言编程指南 十五
- 基础知识(十五)python简单http服务器
- 一起学Netty(十五)之 AttributeMap属性
- 汇编学习(十五)X86汇编学习 (2)MBR为例
- 学习进度条十五
- WCF学习之旅—WCF4.0中的简化配置功能(十五)
- 前景检测算法(十五)--LOBSTER算法
- 跟我学Android UI高级之十五碎片Fragment
- (十五)、构造方法
- 运动目标跟踪(十五)--WMIL跟踪
- Impala实践之十五:Impala使用文档