C语言头文件大全(free)
- 格式:pdf
- 大小:140.84 KB
- 文档页数:4
C语言中的头文件是包含在源代码文件中以便在编译时进行预处理的文件。
头文件通常包含函数、宏定义、结构体声明和其他重要的代码片段,以便在多个源文件中共享和重用。
一些常见的C语言头文件包括:
1. `<stdio.h>`:包含输入输出函数,如`printf` 和`scanf`。
2. `<stdlib.h>`:包含内存分配和释放函数,如`malloc` 和`free`,以及其他常用的函数。
3. `<string.h>`:包含字符串操作函数,如`strcpy`、`strlen` 和`strcmp`。
4. `<math.h>`:包含数学函数,如三角函数、指数函数等。
5. `<time.h>`:包含时间和日期相关的函数,如`time` 和`strftime`。
6. `<ctype.h>`:包含字符分类函数,如`isalpha` 和`isdigit`。
7. `<stdbool.h>`:定义了`bool` 类型和`true`、`false` 常量,用于布尔值。
8. `<stddef.h>`:定义了`NULL` 宏和一些与指针相关的类型。
这只是一小部分常用的C语言头文件,实际上还有很多其他头文件,每个头文件都提供了特定的功能。
通过包含适当的头文件,你可
以在C程序中使用相应的函数和定义。
函数原形的头文件读者可参考返回非整型值的函数assert.h - assert(), 声明宏ctype.h –字符类型函数float.h –浮点数原形limits.h –数据类型的大小和范围math.h –浮点运算函数stdarg.h –变量参数表.stddef.h –标准定义stdio.h –标准输入输出IO 函数stdlib.h –包含内存分配函数的标准库string.h –字符串处理函数3 字符类型库下列函数按照输入的ACS II 字符集字符分类使用这些函数之前应当用"#include <ctype.h>" 包含int isalnum(int c)如果c 是数字或字母返回非零数值否则返回零int isalpha(int c)如果c 是字母返回非零数值否则返回零int iscntrl(int c)如果c 是控制字符如FF, BELL, LF ..等返回非零数值否则返回零int isdigit(int c)如果c 是数字返回非零数值否则返回零int isgraph(int c)如果c 是一个可打印字符而非空格返回非零数值否则返回零int islower(int c)如果c 是小写字母返回非零数值否则返回零int isprint(int c)如果c 是一个可打印字符返回非零数值否则返回零int ispunct(int c)如果c 是一个可打印字符而不是空格数字或字母返回非零数值否则返回零int isspace(int c)如果c 是一个空格字符返回非零数值包括空格CR, FF, HT, NL, 和VT 否则返回零int isupper(int c)如果c 是大写字母返回非零数值否则返回零int isxdigit(int c)如果c 是十六进制数字返回非零数值否则返回零int tolower(int c)如果c 是大写字母则返回c 对应的小写字母其它类型仍然返回cint toupper(int c)如果c 是小写字母则返回c 对应的大写字母其它类型仍然返回c4 浮点运算库下列函数支持浮点数运算使用这些函数之前必须用#include <math.h> 包含float asin(float x)以弧度形式返回x 的反正弦值float acos(float x)以弧度形式返回x 的反余弦值float atan(float x)以弧度形式返回x 的反正切值float atan2(float x, float y)返回y/x 的反正切其范围在- ~+ 之间float ceil(float x)返回对应x 的一个整型数小数部分四舍五入float cos(float x)返回以弧度形式表示的x 的余弦值float cosh(float x)返回x 的双曲余弦函数值float exp(float x)返回以e 为底的x 的幂即e xfloat exp10(float x)返回以10 为底的幂即10xfloat fabs(float x)返回x 的绝对值float floor(float x)返回不大于x 的最大整数float fmod(float x, float y)返回x/y 的余数float frexp(float x, int *pexp)把浮点数x 分解成数字部分y 尾数和以2 为底的指数n 两个部分即x=y 2 n y 的范围为0.5 y 1 y 值被函数返回而n 值存放到pexp 指向的变量中float fround(float x)返回最接近x 的整型数float ldexp(float x, int exp)返回x 2 e x pfloat log(float x)返回x 的自然对数float log10(float x)返回以10 为底的x 的对数float modf(float x, float *pint)把浮点数分解成整数部分和小数部分整数部分存放到pint 指向的变量小数部分应当大于或等于0 而小于1 并且作为函数返回值返回float pow(float x, float y)返回x y 值float sqrt(float x)返回x 的平方根float sin(float x)返回以弧度形式表示的x 的正弦值float sinh(float x)返回x 的双曲正弦函数值float tan(float x)返回以弧度形式表示的x 的正切值float tanh(float x)返回x 的双曲正切函数值5 标准输入输出库标准的文件输入输出是不能真正植入微控制器MCU 的标准stdio.h 的许多内容不可以使用不过有一些IO 函数是被支持的同样使用之前应用"#include <stdio.h>"预处理并且需要初始化输出端口最低层的IO 程序是单字符的输入(getchar)和输出(putchar)程序如果你针对不同的装置使用高层的IO 函数例如用printf 输出LCD 你需要全部重新定义最底层的函数为在ATMEL 的AVR Studio 模拟器终端IO 窗口使用标准IO 函数应当在编译选项中选中相应的单选钮注意作为缺省单字符输出函数putchar 是输出到UART 装置没有修改无论如何为使输出能如期望的那样出现在程序终端窗口中'\n' 字符必须被映射为成对的回车和换行CR/LFint getchar()使用查寻方式从UART 返回一个字符int printf(char *fmt, ..)按照格式说明符输出格式化文本frm 字符串格式说明符是标准格式的一个子集%d--输出有符号十进制整数%o --输出无符号八进制整数%x - 输出无符号十六进制整数%X –除了大写字母使用'A'-'F'外同%x%u - 输出无符号十进制整数%s –输出一个以C 中空字符NULL 结束的字符串%c –以ASCII 字符形式输出只输出一个字符%f –以小数形式输出浮点数%S –输出在FLASH 存贮器中的字符串常量printf 支持三个版本取决于你的特别需要和代码的大小越高的要求代码越大基本形: 只有%c, %d, %x, %u, 和%s 格式说明符是承认的长整形: 针对长整形数的修改%ld, %lu, %lx 被支持, 以适用于精度要求较高的领域浮点形: 全部格式包括%f 被支持你使用编译选项对话框来选择版本代码大小的增加是值得关注的int putchar(int c)输出单个字符这个库程序使用了UART 以查寻方式输出单个字符注意输出’\n’字符至程序终端窗口int puts(char *s)输出以NL 结尾的字符串int sprintf(char *buf, char *fmt)按照格式说明符输出格式化文本frm 字符串到一个缓冲区格式说明符同printf( )"const char *" 支持功能cprintf 和csprintf 是将FLASH 中的格式字符串分别以prinf 和sprinf 形式输出6 标准库和内存分配函数标准库头文件<stdlib.h>定义了宏NULL 和RAND_MAX 和新定义的类型size_t 并且描述了下列函数注意在你调用任意内存分配程序比如.. calloc malloc 和realloc)之前必须调用_NewHeap 来初始化堆heapint abs(int i)返回i 的绝对值int atoi(char *s)转换字符串s 为整型数并返回它字符串s 起始必须是整型数形式字符否则返回0double atof(const char *s)转换转换字符串s 为双精度浮点数并返回它字符串s 起始必须是浮点数形式字符串long atol(char *s)转换字符串s 为长整型数并返回它字符串s 起始必须是长整型数形式字符否则返回0void *calloc(size_t nelem, size_t size)分配"nelem"个数据项的内存连续空间每个数据项的大小为size 字节并且初始化为0 如果分配成功返回分配内存单元的首地址否则返回0void exit(status)终止程序运行典型的是无限循环它是担任用户main 函数的返回点void free(void *ptr)释放ptr 所指向的内存区void *malloc(size_t size)分配size 字节的存贮区如果分配成功则返回内存区地址如内存不够分配则返回0void _NewHeap(void *start, void *end)初始化内存分配程序的堆一个典型的调用是将符号_bss_end+1 的地址用作"start"值符号_bss_end 定义为编译器用来存放全局变量和字符串的数据内存的结束加1 的目的是堆栈检查函数使用_bss_end 字节存贮为标志字节这个结束值不能被放入堆栈中extern char _bss_end;_NewHeap(&_bss_end+1, &_bss_end + 201); // 初始化200 字节大小的堆int rand(void)返回一个在0 和RAND_MAX 之间的随机数void *realloc(void *ptr, size_t size)重新分配ptr 所指向内存区的大小为size 字节size 可比原来大或小返回指向该内存区的地址指针void srand(unsigned seed)初始化随后调用的随机数发生器的种子数long strtol(char *s, char **endptr, int base)按照"base."的格式转换"s"中起始字符为长整型数如果"endptr"不为空* endptr 将设定"s"中转换结束的位置unsigned long strtoul(char *s, char **endptr, int base)除了返回类型为无符号长整型数外其余同"strtol"7 字符串函数用"#include <string.h>"预处理后编译器支持下列函数<string.h>定义了NULL 类型size_t和下列字符串及字符阵列函数void *memchr(void *s, int c, size_t n)在字符串s 中搜索n 个字节长度寻找与c 相同的字符如果成功返回匹配字符的地址指针否则返回NULLint memcmp(void *s1, void *s2, size_t n)对字符串s1 和s2 的前n 个字符进行比较如果相同则返回0 如果s1 中字符大于s2 中字符则返回1 如果s1 中字符小于s2 中字符则返回-1void *memcpy(void *s1, void *s2, size_t n)拷贝s2 中n 个字符至s1 但拷贝区不可以重迭void *memmove(void *s1, void *s2, size_t n)拷贝s2 中n 个字符至s1 返回s1 其与memcpy 基本相同但拷贝区可以重迭void *memset(void *s, int c, size_t n)在s 中填充n 个字节的c 它返回schar *strcat(char *s1, char *s2)拷贝s2 到s1 的结尾返回s1char *strchr(char *s, int c)在s1 中搜索第一个出现的c 包括结束NULL 字符如果成功返回指向匹配字符的指针如果没有匹配字符找到返回空指针int strcmp(char *s1, char *s2)比较两个字符串如果相同返回0 如果s1>s2 则返回1 如果s1<s2 则返回-1char *strcpy(char *s1, char *s2)拷贝字符串s2 至字符串s1 返回s1size_t strcspn(char *s1, char *s2)在字符串s1 搜索与字符串s2 匹配的第一个字符包括结束NULL 字符其返回s1 中找到的匹配字符的索引size_t strlen(char *s)返回字符串s 的长度不包括结束NULL 字符char *strncat(char *s1, char *s2, size_t n)拷贝字符串s2 不含结束NULL 字符中n 个字符到s1 如果s2 长度比n 小则只拷贝s2返回s1int strncmp(char *s1, char *s2, size_t n)基本和strcmp 函数相同但其只比较前n 个字符char *strncpy(char *s1, char *s2, size_t n)基本和strcpy 函数相同但其只拷贝前n 个字符char *strpbrk(char *s1, char *s2)基本和strcspn 函数相同但它返回的是在s1 匹配字符的地址指针否则返回NULL 指针char *strrchr(char *s, int c)在字符串s 中搜索最后出现的c 并返回它的指针否则返回NULL .size_t strspn(char *s1, char *s2)在字符串s1 搜索与字符串s2 不匹配的第一个字符包括结束NULL 字符其返回s1 中找到的第一个不匹配字符的索引char *strstr(char *s1, char *s2)在字符串s1 中找到与s2 匹配的子字符串如果成功它返回s1 中匹配子字符串的地址指针否则返回NULL"const char *" 支持函数这些函数除了它的操作对象是在FLASH 中常数字符串外其余同c 中的函数size_t cstrlen(const char *s)char *cstrcpy(char *dst, const char *src);int cstrcmp(const char *s1, char *s2);8 变量参数函数<stdarg.h>提供再入式函数的变量参数处理它定义了不确定的类型va_list 和三个宏va_start(va_list foo, <last-arg>)初始化变量foova_arg(va_list foo, <promoted type>)访问下一个参数分派指定的类型注意那个类型必须是高级类型如int long 或double小的整型类型如"char"不能被支持va_end(va_list foo)结束变量参数处理例如printf()可以使用vfprintf()来实现#include <stdarg.h>int printf(char *fmt, ...){va_list ap;va_start(ap, fmt);vfprintf(fmt, ap);va_end(ap);}9 堆栈检查函数有几个库函数是用于检查堆栈是否溢出内存图如下如果硬件堆栈增长到软件堆栈中那么软件堆栈的内容将会被改变也就是说局部变量和别的堆栈项目被改变硬件堆栈是用作函数的返回地址如果你的函数调用层次太深偶然会发生这种情况同样地软件堆栈溢出进数据区域将会改变全局变量或其它静态分配的项目如果你使用动态分配内存还会改变堆项目这种情况在你定义了太多的局部变量或一个局部集合变量太大也会偶然发生高端地址硬件堆栈区警戒线软件堆栈区警戒线数据区低端地址警戒线启动代码写了一个正确的关于数据区的地址字节和一个类似的正确的关于软件堆栈的地址字节作为警戒线[注意如果你使用了你自己的启动文件而其又是以6.20 版本之前的启动文件为基础的你将需要额外改造为新的启动文件]注意如果你使用动态分配内存你必须跳过警戒线字节_bss_end 来分配你的堆参考内存分配函数堆栈检查你调用_StackCheck(void)函数来检查堆栈溢出如果警戒线字节仍然保持正确的值那么函数检查通过如果堆栈溢出那么警戒线字节将可能被破坏注意当你的程序堆栈溢出的时候你的程序将可能运行不正常或偶然崩溃当_StackCheck 检查错误条件时它调用了带一个参数的函数_StackOverflowed(char c) 如果参数是1 那么硬件堆栈有过溢出如果参数是0 那么软件堆栈曾经溢出在那个例子中制造了两个功能调用它是两个堆栈都可能溢出的无论如何在_StackOverflowed 执行起作用时第二个调用不可以出现作为例子如果函数复位了CPU 那么将不能返回_StackCheck 函数缺省的_StackOverflowed 函数当它被调用时库会用一个缺省的_StackOverflowed 函数来跳转到0 的位置因此复位CPU 和程序你可能希望用一个函数来代替它以指示更多的错__。
头文件ctype.h函数列表<>函数类别函数用途详细说明字符测试是否字母和数字isalnum 是否字母isalpha 是否控制字符iscntrl 是否数字isdigit 是否可显示字符(除空格外)isgraph 是否可显示字符(包括空格)isprint 是否既不是空格,又不是字母和数字的可显示字符是否空格isspace 是否大写字母isupper 是否16 进制数字(0-9,A-F )字符isxdigit 字符大小写转换函数转换为大写字母toupper 转换为小写字母tolowerispunct 地区化本类别的函数用于处理不同国家的语言差异头文件local.h 函数列表函数类别函数用途详细说明地区控制地区设置setlocale数字格式约定查询国家的货币、日期、时间等的格式转换localeconv数学函数本分类给出了各种数学计算函数,必须提醒的是ANSI C 标准中的数据格式并不符合IEEE754 标准,一些C 语言编译器却遵循IEEE754(例如frinklin C51)头文件math.h函数列表函数类别函数用途详细说明错误条件处理定义域错误(函数的输入参数值不在规定的范围内)值域错误(函数的返回值不在规定的范围内)三角函数反余弦acos反正弦asin 反正切atan反正切2 atan2余弦cos 正弦sin 正切tan 双曲函数双曲余弦cosh 双曲正弦sinh 双曲正切tanh 指数和对数指数函数exp 指数分解函数frexp 乘积指数函数fdexp 自然对数log 以10 为底的对数log10 浮点数分解函数modf 幂函数幂函数pow 平方根函数sqrt 整数截断,绝对值和求余数函数求下限接近整数绝对值fabs 求上限接近整数floor 求余数fmod本分类函数用于实现在不同底函数之间直接跳转代码文件setjmp.h io.h函数列表函数类别函数用途详细说明保存调用环境setjmpceil恢复调用环境longjmp信号处理该分类函数用于处理那些在程序执行过程中发生例外的情况。
标准库函数地头文件---------------------------------------------------------------------- 函数头文件----------------------------------------------------------------------abort stdlib.habs stdlib.h acos math.h asctime time.hasin math.h assert assert.hatan math.h atan2 math.h atexit stdlib.hatof stdlib.hatoi stdlib.hatol stdlib.h bsearch stdlib.h BUFSIZ stdio.h calloc stdlib.hceil math.h clearerr stdio.hclock time.h CLOCKS-PER-SEC time.hclock_t time.hcos math.h cosh math.h ctime time.h difftime time.hdiv stdlib.hdiv_t stdlib.h EDOM errno.h EOF stdio.h ERANGE errno.h errno errno.hexit stdlib.h EXIT_FAILURE stdlib.h EXIT_SUCCESS stdlib.hexp math.h fabs math.h fclose stdio.hfeof stdio.h ferror stdio.hfgetc stdio.h fgetpos stdio.h fgets stdio.h FILE stdio.h FILENAME-MAX stdio.h floor math.h fmod math.h fopen stdio.h FOPEN_MAX stdio.h fpos_t stdio.h fpnntf stdio.h fputc stdio.h fputs stdio.h head stdio.h free stdlib.h freopen stdio.h frexp math.h fscanf stdio.h fseek stdio.h fsetpos stdio.h ftell stdio.h fwrite stdio.h getc stdio.h getchar stdio.h getenv stdlib.h gets stdio.h gmtime time.h HUGE-V AL math.h _IOFBF stdio.h _IOLBF stdio.h _IONBF stdio.h isalnum ctype.h isalpha ctype.h iscntrl ctype.h isdigit ctype.h isgraph ctype.h islower ctype.h isprint ctype.h ispunct ctype.h isspace ctype.h isupper ctype.h isxdigit ctype.h jmp_buf setjmp.hLC_ALL locale.hLC_COLLATE locale.hLC_CTYPE locale.hLC_MONETARY locale.hLC_NUMERIC locale.hLC_TIME locale.hstruct lconv locale.hldexp math.hldiv stdlib.hldiv_t stdlib.hlocaleconv locale.hlocaltime timehlog math.hlog10 math.hlongjmp setjmp.hL_tmpnam stdio.hmalloc stdlib.hmblen stdlib.hmbstowcs stdlib.hmbtowc stdlib.hMB_CUR_MAX stdlib.hmemchr string.hmemcmp string.hmemcpy string.hmemmove string.hmemset string.hmktime time.hmodf math.hNDEBUG assert.hNULL locale.h stddef.h stdio.h stdlib.h string.h time.hoffsetof stddef.hperror stdio.hpow math.hprintf stdio.hptrdiff_t stddef.hputc stdio.hputchar stdio.hputs stdio.hqsort stdlib.hraise signal.hrand stdlib.hRAND_MAX stdlib.hremove stdio.hrename stdio.hrewind stdio.hscanf stdio.hSEEK_CUR stdio.hSEEK_END stdio.hSEEK_SET stdio.hsetbuf stdio.hsetjmp setjmp. hsetlocale locale.hsetvbuf stdio.hSIGABRT signal.hSIGFPE signal.hSIGILL signal.hSIGINT signal.hsignal signal.hSIGSEGV signal.hSIGTERM signal.hsig_atomic_t signal.hSIG_DFL signal.hSIG_ERR signal.hSIG_IGN signal.hsin math.hsinh math.hsize_t stddef.h stdlib.h string.hsprintf stdio.hsqrt math.hsrand stdlib.hsscanf stdio.hstderr stdio.hstdin stdio.hstdout stdio.hstrcat string.hstrchr string.hstrcmp string.hstrcoll string.hstrcpy string.hstrcspn string.hstrerror string.hstrftime time.hstrlen string.hstrncat string.hstrncpy string.h strpbrk string.h strrchr string.h strspn string.h strstr string.h strtod stdlib.h strtok string.h strtol stdlib.h strtoul stdlib.h strxfrm string.h system stblib.h tan math.h tanh math.h time time.h time_t time.h struct tm time.h tmpfile stdio.h tmpnam stdio.h TMP_MAX stdio.h tolower ctype.h toupper ctype.h ungetc stdio.h va_arg stdarg.h va_end stdarg.h valist stdarg.h va_ start stdarg.h vfprintf stdio.h vprintf stdio.h vsprintf stdio.h wchar_t stddef.h. wcstombs stdlib.h wctomb stdlib.h----------------------------------------------------版权申明本文部分内容,包括文字、图片、以及设计等在网上搜集整理.版权为个人所有This article includes some parts, including text, pictures, and design. Copyright is personal ownership.用户可将本文地内容或服务用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律地规定,不得侵犯本网站及相关权利人地合法权利.除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人地书面许可,并支付报酬.Users may use the contents or services of this article for personal study, research or appreciation, and othernon-commercial or non-profit purposes, but at the same time, they shall abide by the provisions of copyright law and other relevant laws, and shall not infringe upon the legitimate rights of this website and its relevant obligees. In addition, when any content or service of this article is used for other purposes, written permission and remuneration shall be obtained from the person concerned and the relevant obligee.转载或引用本文内容必须是以新闻性或资料性公共免费信息为使用目地地合理、善意引用,不得对本文内容原意进行曲解、修改,并自负版权等法律责任.Reproduction or quotation of the content of this article must be reasonable and good-faith citation for the use of news or informative public free information. It shall not misinterpret or modify the original intention of the content of this article, and shall bear legal liability such as copyright.。
c语言头文件大全ctype.h字符处理函数: 本类别函数用于对单个字符进行处理,包括字符的类别测试和字符的大小写转换----------------------------------------字符测试是否字母和数字isalnum是否字母isalpha是否控制字符iscntrl是否数字isdigit是否可显示字符(除空格外) isgraph是否可显示字符(包括空格) isprint是否既不是空格,又不是字母和数字的可显示字符ispunct是否空格isspace是否大写字母isupper是否16进制数字(0-9,A-F)字符isxdigit字符大小写转换函数转换为大写字母toupper转换为小写字母tolower头文件local.h地区化: 本类别的函数用于处理不同国家的语言差异。
----------------------------------------地区控制地区设置setlocale数字格式约定查询国家的货币、日期、时间等的格式转换localeconv头文件math.h数学函数: 本分类给出了各种数学计算函数,必须提醒的是ANSIC标准中的数据格式并不符合IEEE754标准,一些C语言编译器却遵循IEEE754(例如frinklin C51)----------------------------------------反余弦acos反正弦asin反正切atan反正切2 atan2余弦cos正弦sin正切tan双曲余弦cosh双曲正弦sinh双曲正切tanh指数函数exp指数分解函数frexp乘积指数函数fdexp自然对数log以10为底的对数log10浮点数分解函数modf幂函数pow平方根函数sqrt求下限接近整数ceil绝对值fabs求上限接近整数floor求余数fmod头文件setjmp.h io.h本分类函数用于实现在不同底函数之间直接跳转代码。
----------------------------------------保存调用环境setjmp恢复调用环境longjmp头文件signal.h信号处理: 该分类函数用于处理那些在程序执行过程中发生例外的情况。
数据结构与算法C语⾔所有头⽂件汇总——持续更新header.h// 顺序表的结构定义#define Maxsize 100//const int Maxsize = 100; // 预先定义⼀个⾜够⼤的常数typedef struct{int data[Maxsize]; // 存放数组的数组int length; // 顺序表的实际长度}SeqList; // 顺序表类型名为SeqList// SeqList L 定义L为⼀个顺序表Linear.h// 单链表的类型定义typedef struct node{int data; // 数据域struct node *next; // 指针域}Node, *LinkList;// 双向循环链表的类型定义struct dbnode{int data;struct dbnode *prior, *next;}typedef struct dbnode *dbpointer;typedef dbpointer DLinkList;Seqstack.h#define maxsize 6//const int maxsize = 6;// 顺序栈typedef struct seqstack{int data[maxsize];int top; // 标志栈顶位置的变量}SeqStk;Lkstack.h// 链栈的定义typedef struct node{int data;struct node *next;}LkStk;SeqQue.h// 顺序队列类型(普通队列和循环队列类型定义都⼀样,都如下:)#define maxsize 20//const int maxsize = 20; int data[maxsize]; int front, rear;}SeqQue;typedef struct cycque{ int data[maxsize]; int front, rear;}CycQue;LkQueue.h// 链队列类型定义typedef struct LinkQueueNode{int data;struct LinkQueueNode *next;}LkQueNodetypedef struct LkQueue{LkQueNode *front, *rear;}LkQue;BinTree.h// ⼆叉链表的类型定义typedef struct btnode{int data;struct btnode *lchild, *rchild; // 指向左右孩⼦的指针}*BinTree;// 三叉链表的类型定义typedef struct ttnode{int data;struct ttnode *lchild, *parent, *rchild;}*TBinTree;Graph.h#define vnum 20// 邻接矩阵typedef struct gp{int vexs[vnum]; // 顶点信息int arcs[vnum][vnum]; // 邻接矩阵int vexnum, arcnum; // 顶点数,边数}Graph;Graphlk.h#define vnum 20// 邻接表的类型定义// 表结点int adjvex; // 下⼀条边的顶点编号int weight; // 权值struct arcnode *nextarc;}ArcNode;// 表头结点typedef struct vexnode{int vextex; // 顶点编号ArcNode *firstarc; // 指向第⼀条边的指针}AdjList[vnum];typedef struct gp{AdjList adjlist;int vexnum, arcnum; // 顶点和边数}Graph;。
标准C语言头文件ISO C标准定义的头文件(24项)〈assert。
h〉验证程序断言<complex.h> 支持复数算术运算<ctype.h〉字符类型〈errno。
h〉出错码<fenv.h> 浮点环境〈float.h> 浮点常量<inttypes.h> 整型格式转换〈iso646。
h〉替代关系操作符宏〈limits.h> 实现常量<locale。
h〉局部类别<math。
h> 数学常量<setjmp.h> 非局部goto〈signal。
h〉信号〈stdarg。
h〉可变参数表〈stdbool.h> 布尔类型和值〈stddef。
h〉标准定义〈stdint。
h〉整型〈stdio.h> 标准I/O库〈stdlib。
h〉实用程序库函数<string.h〉字符串操作<tgmath.h〉通用类型数学宏〈time。
h〉时间和日期<wchar.h〉宽字符支持〈wctype。
h> 宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)〈dirent。
h> 目录项<fcntl。
h〉文件控制<fnmatch.h> 文件名匹配类型〈glob。
h> 路径名模式匹配类型<grp。
h〉组文件<netdb.h> 网络数据库操作<pwd。
h> 口令文件<regex。
h〉正则表达式〈tar。
h> tar归档值<termios.h〉终端I/O 〈unistd.h> 符号常量〈utime.h> 文件时间〈wordexp。
h> 字扩展类型<arpa/inet。
h〉 Internet定义〈net/if.h〉套接字本地接口〈netinet/in。
h> Internet地址族 <netinet/tcp.h> 传输控制协议<sys/mman。
C/C++头文件一览C、传统C++#include<assert.h>//设定插入点#include<ctype.h>//字符处理#include<errno.h>//定义错误码#include<float.h>//浮点数处理#include<fstream.h>//文件输入/输出#include<iomanip.h>//参数化输入/输出#include<iostream.h>//数据流输入/输出#include<limits.h>//定义各种数据类型最值常量#include<locale.h>//定义本地化函数#include<math.h>//定义数学函数#include<stdio.h>//定义输入/输出函数#include<stdlib.h>//定义杂项函数及内存分配函数#include<string.h>//字符串处理#include<strstrea.h>//基于数组的输入/输出#include<time.h>//定义关于时间的函数#include<wchar.h>//宽字符处理及输入/输出#include<wctype.h>//宽字符分类标准C语言头文件ISO C标准定义的头文件(24项)<assert.h>验证程序断言<complex.h>支持复数算术运算<ctype.h>字符类型<errno.h>出错码<fenv.h>浮点环境<float.h>浮点常量<inttypes.h>整型格式转换<iso646.h>替代关系操作符宏<limits.h>实现常量<locale.h>局部类别<math.h>数学常量<setjmp.h>非局部goto<signal.h>信号<stdarg.h>可变参数表<stdbool.h>布尔类型和值<stddef.h>标准定义<stdint.h>整型<stdio.h>标准I/O库<stdlib.h>实用程序库函数<string.h>字符串操作<tgmath.h>通用类型数学宏<time.h>时间和日期<wchar.h>宽字符支持<wctype.h>宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h>目录项<fcntl.h>文件控制<fnmatch.h>文件名匹配类型<glob.h>路径名模式匹配类型<grp.h>组文件<netdb.h>网络数据库操作<pwd.h>口令文件<regex.h>正则表达式<tar.h>tar归档值<termios.h>终端I/O<unistd.h>符号常量<utime.h>文件时间<wordexp.h>字扩展类型<arpa/inet.h>Internet定义<net/if.h>套接字本地接口<netinet/in.h>Internet地址族<netinet/tcp.h>传输控制协议<sys/mman.h>内存管理声明<sys/select.h>select函数<sys/socket.h>套接字接口<sys/stat.h>文件状态<sys/times.h>进程时间<sys/types.h>基本系统数据类型<sys/un.h>UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h>进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h>cpio归档值<dlfcn.h>动态链接<fmtmsg.h>消息显示结构<ftw.h>文件树漫游<iconv.h>代码集转换实用程序<langinfo.h>语言信息常量<libgen.h>模式匹配函数定义<monetary.h>货币类型<ndbm.h>数据库操作<nl_types.h>消息类别<poll.h>轮询函数<search.h>搜索表<strings.h>字符串操作<syslog.h>系统出错日志记录<ucontext.h>用户上下文<ulimit.h>用户限制<utmpx.h>用户帐户数据库<sys/ipc.h>IPC<sys/msg.h>消息队列<sys/resource.h>资源操作<sys/sem.h>信号量<sys/shm.h>共享存储<sys/statvfs.h>文件系统信息<sys/time.h>时间类型<sys/timeb.h>附加的时间<sys/uio.h>矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h>异步I/O<mqueue.h>消息队列<pthread.h>线程<sched.h>执行调度<semaphore.h>信号量<spawn.h>实时spawn接口<stropts.h>XSI STREAMS接口<trace.h>时间跟踪标准C++语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm>STL通用算法<bitset>STL位集容器<cassert>用于在程序运行时执行断言<cctype>字符处理<cerrno>错误码<cfloat>用于测试浮点类型属性<ciso646>ISO646变体字符集<climits>测试整数类型属性<clocale>本地化函数<cmath>数学函数<complex>复数类<csetjmp>执行非内部的goto语句<csignal>信号<cstdarg>访问参数数量变化的函数<cstddef>用于定义实用的类型和宏<cstdio>输入/输出<cstdlib>杂项函数及内存分配<cstring>字符串<ctime>时间<cwchar>宽字符处理及输入/输出<cwctype>宽字符分类<deque>STL双端队列容器<exception>异常处理类<fstream>文件流<functional>STL函数对象<iomanip>参数化输入/输出<ios>基本输入/输出支持<iosfwd>输入/输出前置声明<iostream>数据流输入/输出<istream>基本输入流<iterator>遍历序列的类<limits>各种数据类型最值常量<list>STL线性列表容器<locale>国际化支持<map>STL映射容器<memory>专用内存分配器<new>基本内存分配和释放<numeric>通用的数字操作<ostream>基本输出流<queue>STL队列容器<set>STL集合容器<sstream>基于字符串的流<stack>STL堆栈容器<stdexcept>标准异常类<streambuf>iostream的缓冲区类<string>字符串类<strstream>非内存字符序列的流类<typeinfo>运行时类型标识<utility>STL通用模板类<valarray>支持值数组的类和模版类<vector>STL动态数组容器标准C++附加的头文件(3个)非必须<hash_map><hash_set><slist>The Standard C++library consists of51required headers.This implementation also includes three additional headers,<hash_map>,<hash_set>,and<slist>,not required by the C++Standard,for a total of54headers.Of these54headers,16constitute the Standard Template Library,or STL.These are indicated below with the notation<algorithm>--(STL)for defining numerous templates that implement useful algorithms<bitset>--for defining a template class that administers sets of bits<complex>--for defining a template class that supports complex arithmetic<deque>--(STL)for defining a template class that implements a deque container<exception>--for defining several functions that control exception handling<fstream>--for defining several iostreams template classes that manipulate exteral files <functional>--(STL)for defining several templates that help construct predicates for the templates defined in<algorithm>and<numeric><hash_map>--(STL)for defining template classes that implement hashed associative containers that map keys to values<hash_set>--(STL)for defining template classes that implement hashed associative containers <iomanip>--for declaring several iostreams manipulators that take an argument<ios>--for defining the template class that serves as the base for many iostreams classes <iosfwd>--for declaring several iostreams template classes before they are necessarily defined<iostream>--for declaring the iostreams objects that manipulate the standard streams<istream>--for defining the template class that performs extractions<iterator>--(STL)for defining several templates that help define and manipulate iterators <limits>--for testing numeric type properties<list>--(STL)for defining a template class that implements a doubly linked list container <locale>--for defining several classes and templates that controllocale-specific behavior,as in the iostreams classes<map>--(STL)for defining template classes that implement associative containers that map keys to values<memory>--(STL)for defining several templates that allocate and free storage for various container classes<new>--for declaring several functions that allocate and free storage<numeric>--(STL)for defining several templates that implement useful numeric functions<ostream>--for defining the template class that performs insertions<queue>--(STL)for defining a template class that implements a queue container<set>--(STL)for defining template classes that implement associative containers<slist>--(STL)for defining a template class that implements a singly linked list container <sstream>--for defining several iostreams template classes that manipulate string containers <stack>--(STL)for defining a template class that implements a stack container<stdexcept>--for defining several classes useful for reporting exceptions<streambuf>--for defining template classes that buffer iostreams operations<string>--for defining a template class that implements a string container<strstream>--for defining several iostreams classes that manipulate in-memory character sequences<typeinfo>--for defining class type_info,the result of the typeid operator<utility>--(STL)for defining several templates of general utility<valarray>--for defining several classes and template classes that support value-oriented arrays<vector>--(STL)for defining a template class that implements a vector container新的C标准库<cassert>--for enforcing assertions when functions execute<cctype>--for classifying characters<cerrno>--for testing error codes reported by library functions<cfloat>--for testing floating-point type properties<ciso646>--for programming in ISO646variant character sets<climits>--for testing integer type properties<clocale>--for adapting to different cultural conventions<cmath>--for computing common mathematical functions<csetjmp>--for executing nonlocal goto statements<csignal>--for controlling various exceptional conditions<cstdarg>--for accessing a varying number of arguments<cstddef>--for defining several useful types and macros<cstdio>--for performing input and output<cstdlib>--for performing a variety of operations<cstring>--for manipulating several kinds of strings<ctime>--for converting between various time and date formats<cwchar>--for manipulating wide streams and several kinds of strings<cwctype>--for classifying wide characters旧的C标准库<assert.h>--for enforcing assertions when functions execute<ctype.h>--for classifying characters<errno.h>--for testing error codes reported by library functions<float.h>--for testing floating-point type properties<iso646.h>--for programming in ISO646variant character sets<limits.h>--for testing integer type properties<locale.h>--for adapting to different cultural conventions<math.h>--for computing common mathematical functions<setjmp.h>--for executing nonlocal goto statements<signal.h>--for controlling various exceptional conditions<stdarg.h>--for accessing a varying number of arguments<stddef.h>--for defining several useful types and macros<stdio.h>--for performing input and output<stdlib.h>--for performing a variety of operations<string.h>--for manipulating several kinds of strings<time.h>--for converting between various time and date formats<wchar.h>--for manipulating wide streams and several kinds of strings<wctype.h>--for classifying wide charactersFinally,in this implementation,the Standard C++library also includes several headers for compatibility with traditional C++libraries:<fstream.h>--for defining several iostreams template classes that manipulate exteral files <iomanip.h>--for declaring several iostreams manipulators that take an argument<iostream.h>--for declaring the iostreams objects that manipulate the standard streams<new.h>--for declaring several functions that allocate and free storage<stl.h>--for declaring several template classes that aid migration from older versions of the Standard Template Library//////////////////////////////////////////////////////////////////////////标准C++(同上的不再注释)#include<algorithm>//STL通用算法#include<bitset>//STL位集容器#include<cctype>#include<cerrno>#include<clocale>#include<cmath>#include<complex>//复数类#include<cstdio>#include<cstdlib>#include<cstring>#include<ctime>#include<deque>//STL双端队列容器#include<exception>//异常处理类#include<fstream>#include<functional>//STL定义运算函数(代替运算符)#include<limits>#include<list>//STL线性列表容器#include<map>//STL映射容器#include<iomanip>#include<ios>//基本输入/输出支持#include<iosfwd>//输入/输出系统使用的前置声明#include<iostream>#include<istream>//基本输入流#include<ostream>//基本输出流#include<queue>//STL队列容器#include<set>//STL集合容器#include<sstream>//基于字符串的流#include<stack>//STL堆栈容器#include<stdexcept>//标准异常类#include<streambuf>//底层输入/输出支持#include<string>//字符串类#include<utility>//STL通用模板类#include<vector>//STL动态数组容器#include<cwchar>#include<cwctype>using namespace std;//////////////////////////////////////////////////////////////////////////C99增加#include<complex.h>//复数处理#include<fenv.h>//浮点环境#include<inttypes.h>//整数格式转换#include<stdbool.h>//布尔环境#include<stdint.h>//整型环境#include<tgmath.h>//通用类型数学宏C头文件大全--------------------------------------------------------------------------------------------------------------------------------------------分类函数,所在函数库为ctype.hint isalpha(int ch)若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0int isalnum(int ch)若ch是字母('A'-'Z','a'-'z')或数字('0'-'9')返回非0值,否则返回0int isascii(int ch)若ch是字符(ASCII码中的0-127)返回非0值,否则返回0int iscntrl(int ch)若ch是作废字符(0x7F)或普通控制字符(0x00-0x1F)返回非0值,否则返回0int isdigit(int ch)若ch是数字('0'-'9')返回非0值,否则返回0int isgraph(int ch)若ch是可打印字符(不含空格)(0x21-0x7E)返回非0值,否则返回0int islower(int ch)若ch是小写字母('a'-'z')返回非0值,否则返回0int isprint(int ch)若ch是可打印字符(含空格)(0x20-0x7E)返回非0值,否则返回0int ispunct(int ch)若ch是标点字符(0x00-0x1F)返回非0值,否则返回0int isspace(int ch)若ch是空格(''),水平制表符('\t'),回车符('\r'),走纸换行('\f'),垂直制表符('\v'),换行符('\n')返回非0值,否则返回0int isupper(int ch)若ch是大写字母('A'-'Z')返回非0值,否则返回0int isxdigit(int ch)若ch是16进制数('0'-'9','A'-'F','a'-'f')返回非0值,否则返回0int tolower(int ch)若ch是大写字母('A'-'Z')返回相应的小写字母('a'-'z')int toupper(int ch)若ch是小写字母('a'-'z')返回相应的大写字母('A'-'Z')--------------------------------------------------------------------------------------------------------------------------------------------数学函数,所在函数库为math.h、stdlib.h、string.h、float.hint abs(int i)返回整型参数i的绝对值double cabs(struct complex znum)返回复数znum的绝对值double fabs(double x)返回双精度参数x的绝对值long labs(long n)返回长整型参数n的绝对值double exp(double x)返回指数函数ex的值double frexp(double value,int*eptr)返回value=x*2n中x的值,n存贮在eptr中double ldexp(double value,int exp);返回value*2exp的值double log(double x)返回logex的值double log10(double x)返回log10x的值double pow(double x,double y)返回xy的值double pow10(int p)返回10p的值double sqrt(double x)返回+√x的值double acos(double x)返回x的反余弦cos-1(x)值,x为弧度double asin(double x)返回x的反正弦sin-1(x)值,x为弧度double atan(double x)返回x的反正切tan-1(x)值,x为弧度double atan2(double y,double x)返回y/x的反正切tan-1(x)值,y的x为弧度double cos(double x)返回x的余弦cos(x)值,x为弧度double sin(double x)返回x的正弦sin(x)值,x为弧度double tan(double x)返回x的正切tan(x)值,x为弧度double cosh(double x)返回x的双曲余弦cosh(x)值,x为弧度double sinh(double x)返回x的双曲正弦sinh(x)值,x为弧度double tanh(double x)返回x的双曲正切tanh(x)值,x为弧度double hypot(double x,double y)返回直角三角形斜边的长度(z),x和y为直角边的长度,z2=x2+y2double ceil(double x)返回不小于x的最小整数double floor(double x)返回不大于x的最大整数void srand(unsigned seed)初始化随机数发生器int rand()产生一个随机数并返回这个数double poly(double x,int n,double c[])从参数产生一个多项式double modf(double value,double*iptr)将双精度数value分解成尾数和阶double fmod(double x,double y)返回x/y的余数double frexp(double value,int*eptr)将双精度数value分成尾数和阶double atof(char*nptr)将字符串nptr转换成浮点数并返回这个浮点数double atoi(char*nptr)将字符串nptr转换成整数并返回这个整数double atol(char*nptr)将字符串nptr转换成长整数并返回这个整数char*ecvt(double value,int ndigit,int*decpt,int*sign)将浮点数value转换成字符串并返回该字符串char*fcvt(double value,int ndigit,int*decpt,int*sign)将浮点数value转换成字符串并返回该字符串char*gcvt(double value,int ndigit,char*buf)将数value转换成字符串并存于buf中,并返回buf的指针char*ultoa(unsigned long value,char*string,int radix)将无符号整型数value转换成字符串并返回该字符串,radix 为转换时所用基数char*ltoa(long value,char*string,int radix)将长整型数value转换成字符串并返回该字符串,radix为转换时所用基数char*itoa(int value,char*string,int radix)将整数value转换成字符串存入string,radix为转换时所用基数double atof(char*nptr)将字符串nptr转换成双精度数,并返回这个数,错误返回0int atoi(char*nptr)将字符串nptr转换成整型数,并返回这个数,错误返回0long atol(char*nptr)将字符串nptr转换成长整型数,并返回这个数,错误返回0double strtod(char*str,char**endptr)将字符串str转换成双精度数,并返回这个数,long strtol(char*str,char**endptr,int base)将字符串str转换成长整型数,并返回这个数,int matherr(struct exception*e)用户修改数学错误返回信息函数(没有必要使用)double_matherr(_mexcep why,char*fun,double*arg1p,double*arg2p,double retval)用户修改数学错误返回信息函数(没有必要使用)unsigned int_clear87()清除浮点状态字并返回原来的浮点状态void_fpreset()重新初使化浮点数学程序包unsigned int_status87()返回浮点状态字--------------------------------------------------------------------------------------------------------------------------------------------目录函数,所在函数库为dir.h、dos.hint chdir(char*path)使指定的目录path(如:"C:\\WPS")变成当前的工作目录,成功返回0int findfirst(char*pathname,struct ffblk*ffblk,int attrib)查找指定的文件,成功返回0pathname为指定的目录名和文件名,如"C:\\WPS\\TXT"ffblk为指定的保存文件信息的一个结构,定义如下:┏━━━━━━━━━━━━━━━━━━┓┃struct ffblk┃┃{┃┃char ff_reserved[21];┃┃char ff_attrib;┃┃int ff_ftime;┃┃int ff_fdate;┃┃long ff_fsize;┃┃char ff_name[13];┃┃}┃┗━━━━━━━━━━━━━━━━━━┛attrib为文件属性,由以下字符代表┏━━━━━━━━━┳━━━━━━━━┓┃FA_RDONLY只读文件┃FA_LABEL卷标号┃┃FA_HIDDEN隐藏文件┃FA_DIREC目录┃┃FA_SYSTEM系统文件┃FA_ARCH档案┃┗━━━━━━━━━┻━━━━━━━━┛例:struct ffblk ff;findfirst("*.wps",&ff,FA_RDONLY);int findnext(struct ffblk*ffblk)取匹配finddirst的文件,成功返回0void fumerge(char*path,char*drive,char*dir,char*name,char*ext)此函数通过盘符drive(C:、A:等),路径dir(\TC、\BC\LIB等),文件名name(TC、WPS等),扩展名ext(.EXE、.COM等)组成一个文件名存与path中.int fnsplit(char*path,char*drive,char*dir,char*name,char*ext)此函数将文件名path分解成盘符drive(C:、A:等),路径dir(\TC、\BC\LIB等),文件名name(TC、WPS等),扩展名ext(.EXE、.COM等),并分别存入相应的变量中.int getcurdir(int drive,char*direc)此函数返回指定驱动器的当前工作目录名称drive指定的驱动器(0=当前,1=A,2=B,3=C等)direc保存指定驱动器当前工作路径的变量成功返回0char*getcwd(char*buf,iint n)此函数取当前工作目录并存入buf中,直到n个字节长为为止.错误返回NULLint getdisk()取当前正在使用的驱动器,返回一个整数(0=A,1=B,2=C等)int setdisk(int drive)设置要使用的驱动器drive(0=A,1=B,2=C等),返回可使用驱动器总数int mkdir(char*pathname)建立一个新的目录pathname,成功返回0int rmdir(char*pathname)删除一个目录pathname,成功返回0char*mktemp(char*template)构造一个当前目录上没有的文件名并存于template中char*searchpath(char*pathname)利用MSDOS找出文件filename所在路径,,此函数使用DOS的PATH变量,未找到文件返回NULL--------------------------------------------------------------------------------------------------------------------------------------------进程函数,所在函数库为stdlib.h、process.hvoid abort()此函数通过调用具有出口代码3的_exit写一个终止信息于stderr,并异常终止程序。
标准C语言头文件ISO C标准定义的头文件(24项)<assert.h> 验证程序断言<complex.h> 支持复数算术运算<ctype.h> 字符类型<errno.h> 出错码<fenv.h> 浮点环境<float.h> 浮点常量<inttypes.h> 整型格式转换<iso646.h> 替代关系操作符宏<limits.h> 实现常量<locale.h> 局部类别<math.h> 数学常量<setjmp.h> 非局部goto<signal.h> 信号<stdarg.h> 可变参数表<stdbool.h> 布尔类型和值<stddef.h> 标准定义<stdint.h> 整型<stdio.h> 标准I/O库<stdlib.h> 实用程序库函数<string.h> 字符串操作<tgmath.h> 通用类型数学宏<time.h> 时间和日期<wchar.h> 宽字符支持<wctype.h> 宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h> 目录项<fcntl.h> 文件控制<fnmatch.h> 文件名匹配类型<glob.h> 路径名模式匹配类型<grp.h> 组文件<netdb.h> 网络数据库操作<pwd.h> 口令文件<regex.h> 正则表达式<tar.h> tar归档值<termios.h> 终端I/O <unistd.h> 符号常量<utime.h> 文件时间<wordexp.h> 字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口<netinet/in.h> Internet地址族 <netinet/tcp.h> 传输控制协议<sys/mman.h> 内存管理声明<sys/select.h> select函数<sys/socket.h> 套接字接口<sys/stat.h> 文件状态<sys/times.h> 进程时间<sys/types.h> 基本系统数据类型<sys/un.h> UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h> 进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h> cpio归档值<dlfcn.h> 动态链接<fmtmsg.h> 消息显示结构<ftw.h> 文件树漫游<iconv.h> 代码集转换实用程序<langinfo.h> 语言信息常量<libgen.h> 模式匹配函数定义<monetary.h> 货币类型<ndbm.h> 数据库操作<nl_types.h> 消息类别<poll.h> 轮询函数<search.h> 搜索表<strings.h> 字符串操作<syslog.h> 系统出错日志记录<ucontext.h> 用户上下文<ulimit.h> 用户限制<utmpx.h> 用户帐户数据库<sys/ipc.h> IPC<sys/msg.h> 消息队列<sys/resource.h> 资源操作<sys/sem.h> 信号量<sys/shm.h> 共享存储<sys/statvfs.h> 文件系统信息<sys/time.h> 时间类型<sys/timeb.h> 附加的时间<sys/uio.h> 矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h> 异步I/O <mqueue.h> 消息队列<pthread.h> 线程<sched.h> 执行调度<semaphore.h> 信号量<spawn.h> 实时spawn接口<stropts.h> XSI STREAMS接口<trace.h> 时间跟踪标准 C++ 语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm>STL通用算法<bitset> STL位集容器<cassert> 用于在程序运行时执行断言<cctype> 字符处理<cerrno> 错误码<cfloat> 用于测试浮点类型属性<ciso646> ISO646变体字符集<climits> 测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex>复数类<csetjmp> 执行非内部的goto语句<csignal> 信号<cstdarg> 访问参数数量变化的函数<cstddef> 用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分配<cstring> 字符串<ctime> 时间<cwchar> 宽字符处理及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异常处理类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios>基本输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 基本输入流<iterator> 遍历序列的类<limits> 各种数据类型最值常量<list>STL线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分配器<new> 基本内存分配和释放<numeric> 通用的数字操作<ostream> 基本输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异常类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream> 非内存字符序列的流类<typeinfo> 运行时类型标识<utility> STL 通用模板类<valarray> 支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件(3个)非必须<hash_map> <hash_set> <slist>The Standard C++ library consists of 51 required headers.This implementation also includes three additional headers,<hash_map>,<hash_set>,and <slist>,not required by the C++ Standard,for a total of 54 headers.Of these 54 headers,16 constitute the Standard Template Library,or STL.These are indicated below with the notation<algorithm> -- (STL) for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic<deque> -- (STL) for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling<fstream> -- for defining several iostreams template classes that manipulate exteral files<functional>-- (STL) for defining several templates that help construct predicates for the templates defined in <algorithm> and <numeric><hash_map> -- (STL) for defining template classes that implement hashed associative containersthat map keys to values<hash_set> -- (STL) for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions<iterator> -- (STL) for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- (STL) for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior, as in the iostreams classes<map>-- (STL) for defining template classes that implement associative containers thatmap keys to values<memory>-- (STL) for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage<numeric>-- (STL) for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions<queue> -- (STL) for defining a template class that implements a queue container<set>-- (STL) for defining template classes that implement associative containers<slist>-- (STL) for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers<stack> -- (STL) for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions<streambuf> -- for defining template classes that buffer iostreams operations<string> -- for defining a template class that implements a string container<strstream> -- for defining several iostreams classes that manipulate in-memory character sequences<typeinfo> -- for defining class type_info, the result of the typeid operator<utility>-- (STL) for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-oriented arrays<vector>-- (STL) for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings<cwctype> -- for classifying wide characters旧的C标准库<assert.h> -- for enforcing assertions when functions execute<ctype.h> -- for classifying characters<errno.h> -- for testing error codes reported by library functions<float.h> -- for testing floating-point type properties<iso646.h> -- for programming in ISO 646 variant character sets<limits.h> -- for testing integer type properties<locale.h> -- for adapting to different cultural conventions<math.h> -- for computing common mathematical functions<setjmp.h> -- for executing nonlocal goto statements<signal.h> -- for controlling various exceptional conditions<stdarg.h> -- for accessing a varying number of arguments<stddef.h> -- for defining several useful types and macros<stdio.h> -- for performing input and output<stdlib.h> -- for performing a variety of operations<string.h> -- for manipulating several kinds of strings<time.h> -- for converting between various time and date formats<wchar.h> -- for manipulating wide streams and several kinds of strings<wctype.h> -- for classifying wide charactersFinally, in this implementation, the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<fstream.h> -- for defining several iostreams template classes that manipulate exteral files <iomanip.h> -- for declaring several iostreams manipulators that take an argument<iostream.h> -- for declaring the iostreams objects that manipulate the standard streams <new.h> -- for declaring several functions that allocate and free storage<stl.h> -- for declaring several template classes that aid migration from older versions of the Standard Template Library。
C语言所有常用头文件用途C语言的头文件是预编译的指令,用来导入函数和变量的声明,以及宏定义等。
常用头文件涵盖了各种操作和功能,大致可以分为系统头文件、标准库头文件和用户自定义头文件等几大类。
下面是一些常用的C语言头文件及其用途的简要介绍。
1. stdio.h:提供输入输出函数。
包括 printf(、scanf(、getchar(、putchar(等函数,用于屏幕输入输出。
2. stdlib.h:提供一些常用的函数和宏,如 memory allocation functions(malloc(、calloc(、realloc()和 exit( 函数等。
3. string.h:提供字符串处理函数。
包括 strcpy(、strcat(、strlen( 和 strcmp(等函数,用于处理字符串相关操作。
4. math.h:提供数学运算函数。
包括 abs(、sqrt(、sin(、cos(、tan(等函数,用于执行数学计算和操作。
6. ctype.h:提供字符处理函数。
例如 isalpha(、isdigit( 和tolower(等函数,用于字符类型判断和转换。
7. assert.h:宏定义用于程序运行时的断言。
例如 assert( 宏,用于在程序运行时检查条件是否满足,如不满足则终止程序。
8. stdarg.h:提供可变参数函数的定义和使用。
包括 va_start(、va_arg( 和 va_end(等宏和函数,用于操作可变参数列表。
9. float.h:提供浮点数相关信息和宏定义。
例如 FLT_MAX、DBL_MAX 和 LDBL_MAX等常量,表示浮点数的最大值。
10. limits.h:提供整数类型的取值范围和宏定义。
例如 INT_MAX、INT_MIN 和 CHAR_BIT等常量,表示整数类型的最大值、最小值和字符位数。
11. stdbool.h:提供布尔类型的定义和宏定义。
包括 bool、true 和 false等常量,表示布尔类型的值。
C语言头文件大全修订版IBMT standardization office【IBMT5AB-IBMT08-IBMT2C-ZZT18】标准C语言头文件ISO C标准定义的头文件(24项)<assert.h> 验证程序断言<complex.h>?支持复数算术运算<ctype.h>?字符类型<errno.h>?出错码<fenv.h>?浮点环境<float.h>?浮点常量<inttypes.h>?整型格式转换<iso646.h> 替代关系操作符宏<limits.h>?实现常量<locale.h>?局部类别<math.h>?数学常量<setjmp.h> 非局部goto<signal.h>?信号<stdarg.h>?可变参数表<stdbool.h>?布尔类型和值<stddef.h>?标准定义<stdint.h>?整型<stdio.h>?标准I/O库<stdlib.h>?实用程序库函数<string.h>?字符串操作<tgmath.h>?通用类型数学宏<time.h>?时间和日期<wchar.h>?宽字符支持<wctype.h>?宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h>?目录项<fcntl.h>?文件控制<fnmatch.h>?文件名匹配类型<glob.h>?路径名模式匹配类型<grp.h>?组文件<netdb.h>?网络数据库操作<pwd.h> 口令文件<regex.h>?正则表达式<tar.h>?tar归档值<termios.h>?终端I/O <unistd.h>?符号常量<utime.h>?文件时间<wordexp.h>?字扩展类型<arpa/inet.h>?Internet定义<net/if.h>?套接字本地接口<netinet/in.h> Internet地址族 <netinet/tcp.h>?传输控制协议<sys/mman.h>?内存管理声明<sys/select.h>?select函数<sys/socket.h>?套接字接口<sys/stat.h>?文件状态<sys/times.h>?进程时间<sys/types.h>?基本系统数据类型<sys/un.h>?UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h>?进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h> cpio归档值<dlfcn.h>?动态链接<fmtmsg.h>?消息显示结构<ftw.h>?文件树漫游<iconv.h>?代码集转换实用程序<langinfo.h>?语言信息常量<libgen.h>?模式匹配函数定义<monetary.h>?货币类型<ndbm.h>?数据库操作<nl_types.h>?消息类别<poll.h>?轮询函数<search.h>?搜索表<strings.h>?字符串操作<syslog.h>?系统出错日志记录<ucontext.h>?用户上下文<ulimit.h>?用户限制<utmpx.h>?用户帐户数据库<sys/ipc.h> IPC<sys/msg.h>?消息队列<sys/resource.h> 资源操作<sys/sem.h>?信号量<sys/shm.h>?共享存储<sys/statvfs.h>?文件系统信息<sys/time.h>?时间类型<sys/timeb.h>?附加的时间<sys/uio.h>?矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h>?异步I/O <mqueue.h>?消息队列<pthread.h>?线程<sched.h>?执行调度<semaphore.h> 信号量<spawn.h>?实时spawn接口<stropts.h>?XSI STREAMS接口<trace.h>?时间跟踪标准 C++ 语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm> STL通用算法<bitset> STL位集容器<cassert>?用于在程序运行时执行断言<cctype> 字符处理<cerrno> 错误码<cfloat>?用于测试浮点类型属性<ciso646>?ISO646变体字符集<climits>?测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex> 复数类<csetjmp>?执行非内部的goto语句<csignal>?信号<cstdarg>?访问参数数量变化的函数<cstddef>?用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分配<cstring> 字符串<ctime> 时间<cwchar> 宽字符处理及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异常处理类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios> 基本输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 基本输入流<iterator> 遍历序列的类<limits> 各种数据类型最值常量<list> STL 线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分配器<new> 基本内存分配和释放? <numeric> 通用的数字操作<ostream> 基本输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异常类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream>?非内存字符序列的流类<typeinfo> 运行时类型标识<utility> STL 通用模板类<valarray>?支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件(3个)非必须<hash_map> <hash_set><slist>The Standard C++ library consists of 51 required headers.This implementation also includes three additional headers,<hash_map>,<hash_set>,and <slist>,not required by the C++ Standard, for a total of 54 headers.Of these 54 headers,16 constitute the Standard Template Library, or STL.These are indicated below with the notation<algorithm> -- (STL) for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic <deque> -- (STL) for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling <fstream> -- for defining several iostreams template classes that manipulate exteral files<functional>-- (STL) for defining several templates that help construct predicates forthe templates defined in <algorithm> and <numeric><hash_map> -- (STL) for defining template classes that implement hashed associative containersthat map keys to values<hash_set> -- (STL) for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions<iterator> -- (STL) for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- (STL) for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior, as in the iostreams classes<map>-- (STL) for defining template classes that implement associative containers thatmap keys to values<memory>-- (STL) for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage<numeric>-- (STL) for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions<queue> -- (STL) for defining a template class that implements a queue container<set>-- (STL) for defining template classes that implement associative containers<slist>-- (STL) for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers<stack> -- (STL) for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions<streambuf> -- for defining template classes that buffer iostreams operations <string> -- for defining a template class that implements a stringcontainer<strstream> -- for defining several iostreams classes that manipulate in-memory charactersequences<typeinfo> -- for defining class type_info, the result of the typeid operator <utility>-- (STL) for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-orientedarrays<vector>-- (STL) for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings <cwctype> -- for classifying wide characters旧的C标准库<assert.h> -- for enforcing assertions when functions execute<ctype.h> -- for classifying characters<errno.h> -- for testing error codes reported by library functions<float.h> -- for testing floating-point type properties<iso646.h> -- for programming in ISO 646 variant character sets<limits.h> -- for testing integer type properties<locale.h> -- for adapting to different cultural conventions<math.h> -- for computing common mathematical functions<setjmp.h> -- for executing nonlocal goto statements<signal.h> -- for controlling various exceptional conditions<stdarg.h> -- for accessing a varying number of arguments<stddef.h> -- for defining several useful types and macros<stdio.h> -- for performing input and output<stdlib.h> -- for performing a variety of operations<string.h> -- for manipulating several kinds of strings<time.h> -- for converting between various time and date formats<wchar.h> -- for manipulating wide streams and several kinds of strings<wctype.h> -- for classifying wide charactersFinally, in this implementation, the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<fstream.h> -- for defining several iostreams template classes that manipulate exteral files<iomanip.h> -- for declaring several iostreams manipulators that take an argument<iostream.h> -- for declaring the iostreams objects that manipulate the standard streams<new.h> -- for declaring several functions that allocate and free storage <stl.h> -- for declaring several template classes that aid migration from older versionsof the Standard Template Library。
C语言函数大全(头文件)C标准库函数abort stdlib. h abs stdlib. h acos math. h asctime time. h asin math. h assert assert.h atan math. h atan2 math. h atexit stdlib. h atof stdlib. h atoi stdlib. h atol stdlib. h bsearch stdlib. h BUFSIZ stdio. h calloc stdlib. hceil math. h clearerr stdio. h clock time. h CLOCKS-PER-SEC time. h clock_t time. hcos math. h cosh math. h ctime time. h difftime time. hdiv stdlib. hdiv_t stdlib. h EDOM errno. h EOF stdio. h ERANGE errno. h errno errno. h exit stdlib. h EXIT_FAILURE stdlib. h EXIT_SUCCESS stdlib. h exp math. h fabs math. h fclose stdio. hfeof stdio.h ferror stdio.h fflush stdio. h fgetc stdio.h fgetpos stdio. hFILE stdio. h FILENAME-MAX stdio. h floor math. h isalpha ctype. h iscntrl ctype. h isdigit ctype. h isgraph ctype. h islower ctype. h isprint ctype. h ispunct ctype. h isspace ctype. h isupper ctype. h isxdigit ctype. hjmp_buf setjmp. h labs stdlib. hLC_ALL locale. h LC_COLLATE locale. h LC_CTYPE locale. h LC_MONETARY locale. h LC_NUMERIC locale. h LC_TIME locale. h struct lconv locale. h ldexp math. hldiv stdlib. hldiv_t stdlib. h localeconv locale. h localtime time. hlog math. hlog10 math. h longjmp setjmp. hL_tmpnam stdio. h malloc stdlib. h mblen stdlib. h mbstowcs stdlib. h mbtowc stdlib. h MB_CUR_MAX stdlib. h memchr string.h memcmp string. h memcpy string. h memmove string. h memset string. hmodf math. hNDEBUG assert. hNULL locale. h.stddef. h.stdio. h.stdlib. h.string.h.time. hoffsetof stddef. hperror stdio.hpow math. hprintf stdio.hptrdiff_t stddef. hputc stdio. hputchar stdio. hstrpbrk string. hstrrchr string. hstrspn string. hstrstr string. hstrtod stdlib. hstrtok string. hstrtol stdlib. hstrtoul stdlib. hstrxfrm string. hsystem stblib. htan math. htanh math. htime time. htime_t time. hstruct tm time. htmpfile stdio. htmpnam stdio. hTMP_MAX stdio. h tolower ctype. h toupper ctype. h ungetc stdio. hva_arg stdarg. hva_end stdarg. hvalist stdarg. hva_ start stdarg. h vfprintf stdio. hvprintf stdio. hvsprintf stdio. hwchar_t stddef. h. stdlib. h wcstombs stdlib. h wctomb stdlib. h。