C语言函数库详解(收藏)
12. <stdlib.h>:实用函数
在头文件<stdlib.h>中声明了一些实现数值转换,内存分配等类似功能的函数。下面给出头文件<stdlib.h>中声明的函数以及功能简介,见下表。 <stdlib.h>中声明的函数 函数定义, 函数功能简介
double atof(const char *s), 将字符串s转换为double类型 int atoi(const char *s) , 将字符串s转换为int类型 long atol(const char *s), 将字符串s转换为long类型
double strtod (const char*s,char **endp) , 将字符串s前缀转换为long strtol(const char*s,char **endp,int base), 将字符串s型
unsinged long strtol(const char*s,char **endp,int base), s型
int rand(void), 产生一个0~RAND_MAXvoid srand(unsigned int seed) , void *calloc(size_t nelem, size_t elsize), void *malloc(unsigned size), 内存分配函数
void *realloc(void *ptr, unsigned newsize), void free(void *ptr), 释放已分配的块 void abort(void), void exit(int status), int atexit(atexit_t func),
char *getenv(char *envvar), void void *key, *nelem, size_t width, int(*fcmp)(const void *, const *)),
使用快速排序例程进行排序
div_t 将两个整数相除, 返回商和余数 两个长整型数相除, 返回商和余数
13. <time.h>:日期与时间函数
在头文件<time.h>中,声明了一些处理日期和时间的类型与函数。clock_t和time_t是两个表示时间值的算术类型。结构struct tm存储了一个日历时间的各个成分。结构tm的成员的意义及其正常的取值范围如下: struct tm { int tm_sec; /*从当前分钟开始经过的秒数(0,61)*/
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库C语言函数库详解(收藏)(13)在线全文阅读。
相关推荐: