C 标准头文件
在 C 语言 中,头文件包含一组预定义的标准库函数。预处理指令 “#include” 用于在程序中包含扩展名为 “.h” 的头文件。
以下是表格中显示的 C 语言中的部分头文件:
| 序号 | 头文件和说明 |
|---|---|
| 1 | stdio.h 输入/输出函数 |
| 2 | conio.h 控制台输入/输出函数 |
| 3 | stdlib.h 常规实用程序函数 |
| 4 | math.h 数学函数 |
| 5 | string.h 字符串函数 |
| 6 | ctype.h 字符处理函数 |
| 7 | time.h 日期和时间函数 |
| 8 | float.h 浮点类型的限制 |
| 9 | limits.h 基本类型大小 |
| 10 | wctype.h 用于确定宽字符数据中包含类型的函数。 |
以下是 C 语言中的头文件示例:
示例
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main() {
char s1[20] = "53875";
char s2[10] = "Hello";
char s3[10] = "World";
int res;
res = pow(8, 4);
printf("Using math.h, The value is : %d\n", res);
long int a = atol(s1);
printf("Using stdlib.h, the string to long int : %d\n", a);
strcpy(s2, s3);
printf("Using string.h, the strings s2 and s3 : %s\t%s\n", s2, s3 );
return 0;
}
输出
以下是输出 -
Using math.h, The value is : 4096 Using stdlib.h, the string to long int : 53875 Using string.h, the strings s2 and s3 : World World
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP