一些常用的函数

1. qsort:void qsort(void *base,int nelem,int width,int (*fcmp)(const void *,const void *));

头文件:#include<stdlib.h>

参数: 1 待排序数组首地址
2 数组中待排序元素数量
3 各元素的占用空间大小
4 指向函数的指针,用于确定排序的顺序
 
2.stycpy函数:

c语言中的函数,需要头文件:<stdio.h>和<string.h>。

char *stycpy(char *dest,const char* src);

把src地址开始且含有null结束符的字符串复制到以dest开始的地址空间。

 

3.sprintf函数:int sprintf(char *buffer,const char*format,[argument]..);

c语言中的函数,需要头文件<stdio.h>。

把格式化的数据写入某个字符串缓冲区,返回字符串的长度。

eg:n=sprintf(buffer,"%d plus %d is %d",a,b,a+b);

 

4.strlen函数:extern unsigned int strlen(char *s);

头文件:<string.h>

 

5.atoi函数:int atoi(const char *nptr);

头文件:<stdlib.h>

字符串转换为整型数

 

posted @ 2015-08-12 09:44  wy1290939507  阅读(154)  评论(0编辑  收藏  举报