https://wenda.so.com/q/1367031948061742 来自360问答
stdlib.h
stdlib 头文件里包含了C语言的一些函数
该文件包含了的C语言标准库函数的定义
stdlib.h里面定义了五种类型、一些宏和通用工具函数。类型例如size_t、wchar_t、div_t、ldiv_t和lldiv_t;宏例如EXIT_FAILURE、EXIT_SUCCESS、RAND_MAX和MB_CUR_MAX等等;常用的函数如malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、 srand()、exit()等等。 具体的内容你自己可以打开编译器的include目录里面的stdlib.h头文件看看。
stdlib.h百科
https://baike.so.com/doc/6737384-6951796.html 360百科
stdlib 头文件即standard library标准库头文件
stdlib 头文件里包含了C、C++语言的最常用的系统函数
该文件包含了C语言标准库函数的定义
包含的函数
输入样式:C语言模式:#include <stdlib.h>
C++样式:#include <cstdlib>
1函数名称:calloc
函数原型: void calloc(unsigned n,unsigned size);
函数功能: 分配n个数据项的内存连续空间,每个数据项的大小为 size
函数返回: 分配内存单元的起始地址,如果不成功,返回0
2函数名称:free
函数原型: void free(void* p);
函数功能: 释放 p 所指的内存区
函数返回:
参数说明: p- 被释放的指针
3函数名称:malloc
函数原型: void * malloc(unsigned size);
函数功能: 分配 size 字节的存储区
函数返回: 所分配的内存区地址,如果内存不够,返回0
4函数名称: realloc
函数原型: void * realloc(void * p,unsigned size);
函数功能: 将 p 所指出的已分配内存区的大小改为 size,size 可以比原来分配的空间大或小
函数返回: 返回指向该内存区的指针.NULL-分配失败
5函数名称: rand
函数原型: int rand(void);
函数功能: 产生0到32767间的随机整数(0到0x7fff之间)
函数返回: 随机整数
6函数名称: abort
函数原型: void abort(void)
函数功能: 异常终止一个进程.
7函数名称: exit
函数原型: void exit(int state)
函数功能: 程序中止执行,返回调用过程
函数返回:
参数说明: state:0- 正常中止,非 0- 非正常中止
8函数名称: getenv
函数原型: char* getenv(const char *name)
函数返回:环境变量的定义
参数说明: name- 环境字符串
9函数名称: putenv
函数原型: int putenv(const char *name)
函数功能: 将字符串name增加到DOS环境变量中
函数返回: 0:操作成功,-1:操作失败
参数说明: name-环境字符串
10函数名称: labs
函数原型: long labs(long num)
函数功能: 求长整型参数的绝对值
函数返回:绝对值
11函数名称: atof
函数原型: double atof(char *str)
函数功能: 将字符串转换成一个双精度数值
函数返回: 转换后的数值
参数说明: str- 待转换浮点型数的字符串
12函数名称: atoi
函数原型: int atoi(char *str)
函数功能: 将字符串转换成一个整数值
函数返回: 转换后的数值
参数说明: str- 待转换为整型数的字符串
13函数名称: atol
函数原型: long atol(char *str)
函数功能: 将字符串转换成一个长整数
函数返回: 转换后的数值
参数说明: str- 待转换为长整型的字符串
14函数名称:ecvt
函数原型: char *ecvt(double value,int ndigit,int *dec,int *sign)
函数功能: 将浮点数转换为字符串
函数返回: 转换后的字符串指针
参数说明: value- 待转换底浮点数,ndigit- 转换后的字符串长度
15函数名称:fcvt
函数原型: char *fcvt(double value,int ndigit,int *dec,int *sign)
函数功能: 将浮点数变成一个字符串
函数返回: 转换后字符串指针
参数说明: value- 待转换底浮点数,ndigit- 转换后底字符串长度
conio.h
conio.h不是C标准库中的头文件。
conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
包含的函数
cgets(char *);
cprintf(const char *, ...);
cputs(const char *);
cscanf(const char *, ...);
inp(unsigned short);
inpw(unsigned short);
getch(void);
getche(void);
kbhit(void);
outp(unsigned short, int);
outpw(unsigned short, unsigned short);
putch(int);
ungetch(int);
void _Cdecl clreol (void);
void _Cdecl clrscr (void);
void _Cdecl delline (void);
int _Cdecl gettext (int left, int top, int right, int bottom,
void *destin);
void _Cdecl gettextinfo (struct text_info *r);
void _Cdecl gotoxy (int x, int y);
void _Cdecl highvideo (void);
void _Cdecl insline (void);
void _Cdecl lowvideo (void);
int _Cdecl movetext (int left, int top, int right, int bottom,
int destleft, int desttop);
void _Cdecl normvideo (void);
int _Cdecl puttext (int left, int top, int right, int bottom,
void *source);
void _Cdecl textattr (int newattr);
void _Cdecl textbackground (int newcolor);
void _Cdecl textcolor (int newcolor);
void _Cdecl textmode (int newmode);
int _Cdecl wherex (void);
int _Cdecl wherey (void);
void _Cdecl window (int left, int top, int right, int bottom);
har *_Cdecl cgets (char *str);
int _Cdecl cprintf (const char *format, ...);
int _Cdecl cputs (const char *str);
int _Cdecl cscanf (const char *format, ...);
int _Cdecl getch (void);
int _Cdecl getche (void);
char *_Cdecl getpass (const char *prompt);
int _Cdecl kbhit (void);
int _Cdecl putch (int c);
int _Cdecl ungetch (int ch);