C中的标准头文件
在C语言中,头文件包含一组预定义的标准库函数。“#include”预处理指令用于在程序中包含扩展名为“.h”的头文件。
下表显示了一些C语言的头文件,
输入/输出功能
控制台输入/输出功能
通用实用程序功能
数学函数
字符串函数
字符处理功能
日期和时间功能
浮点类型的限制
基本类型的大小
用于确定宽字符数据中包含的类型的函数。
这是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