- 2
- 0
- 约9.28千字
- 约 12页
- 2018-11-16 发布于江苏
- 举报
C语言函数大全q,r开头详细版
C语言函数大全(q,r开头)
函数名: qsort
功能: 使用快速排序例程进行排序
用法: void qsort(void *base, int nelem, int width, int (*fcmp)());
程序例:
#include#include#includeint 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) );}
函数名: qsort
功能: 使用快速排序例程进行排序
用法: void qsort(void *base, int nelem, int width, int (*fcmp)());
程序例:
#include#include#includeint 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) );}
函数名: raise
功能: 向正在执行的程序发送一个信号
用法: int raise(int sig);
程序例:
#includeint main(void){int a, b;a = 10;b = 0;if (b == 0)/* preempt divide by zero error */raise(SIGFPE);a = a / b;return 0;}
函数名: rand
功能: 随机数发生器
用法: void rand(void);
程序例:
#include#includeint main(void){int i;printf(Ten random numbers from 0 to 99\n\n);for(i=0; i10; i++)printf(%d\n, rand() % 100);return 0;}
函数名: randbrd
功能: 随机块读
用法: int randbrd(struct fcb *fcbptr, int reccnt);
程序例:
#include#include#include#includeint main(void){char far *save_dta;char line[80], buffer[256];struct fcb blk;int i, result;/* get user input file name for dta */printf(Enter drive and file name (no path - i.e. a:file.dat)\n);gets(line);/* put file name in fcb */if (!parsfnm(line, blk, 1)){printf(Error in call to parsfnm\n);exit(1);}printf(Drive #%d File: %s\n\n, blk.fcb_drive, blk.fcb_name);/* open file with DOS FCB open file */bdosptr(0x0F, blk, 0);/* save old dta, and set new one */save_dta = getdta();setdta(buffer);/* set up info for the new dta */blk.fcb_recsize = 128;blk.fcb_random = 0L;result = randbrd(blk,
您可能关注的文档
最近下载
- ISO 10156-2017 气瓶-气体和混合气体-确定火势和氧化能力以选择气瓶阀门出口(中文版).pdf
- 2025年新版《煤矿安全规程》考试题库及答案.docx VIP
- 石砌挡墙工程监理实施细则经典版.doc VIP
- JADC2虚拟系统实验环境.pdf VIP
- 重庆市市政工程初步设计文件编制技术规定(2024年版).docx VIP
- GB2828-2012抽样计划详表.xls VIP
- 触电安全知识.pptx VIP
- 网页设计与制作案例教程(第2版)(胡秀娥) 项目五(网页列表与超链接) .docx VIP
- HG∕T 5960-2021 废(污)水处理用复合碳源.pdf
- 设备产品质量计划.doc VIP
原创力文档

文档评论(0)