头文件stdio.h代表标准输入输出。它具有与输入/输出功能有关的信息。
下表显示了用C语言显示的stdio.h中的一些功能,
| 序号 | 功能与说明 | 
|---|---|
| 1个 | printf() 用于在输出屏幕上打印字符串,整数,字符等。 | 
| 2 | scanf() 从键盘读取字符,字符串,整数等。 | 
| 3 | getc() 从文件中读取字符。 | 
| 4 | putc() 将该字符写入文件。 | 
| 5 | fopen() 打开文件,所有文件处理功能都在stdio.h头文件中定义。 | 
| 6 | fclose() 关闭打开的文件。 | 
| 7 | remove() 删除文件。 | 
| 8 | fflush() 刷新文件。 | 
这是C语言中的stdio.h的示例,
#include<stdio.h>
int main () {
   char val;
   printf("Enter the character: \n");
   val = getc(stdin);
   printf("Character entered: ");
   putc(val, stdout);
   return(0);
}输出结果
这是输出
Enter the character: s Character entered: s
头文件stdlib.h代表标准库。它具有内存分配/释放功能的信息。
下表显示了用C语言显示的stdlib.h中的某些功能,
| 序号 | 功能与说明 | 
|---|---|
| 1个 | malloc() 在程序执行期间分配内存。 | 
| 2 | free() 释放分配的内存。 | 
| 3 | abort() 终止C程序。 | 
| 4 | exit() 终止程序,不返回任何值。 | 
| 5 | atol() 将字符串转换为long int。 | 
| 6 | atoll() 它将字符串转换为long long int。 | 
| 7 | atof() 将字符串转换为浮点值。 | 
| 8 | rand() 返回一个随机整数值 | 
这是C语言中的stdlib.h的示例,
#include <stdio.h>
#include<stdlib.h>
int main() {
   char str1[20] = "53875";
   char str2[20] = "367587938";
   char str3[20] = "53875.8843";
   long int a = atol(str1);
   printf("String to long int : %d\n", a);
   long long int b = atoll(str2);
   printf("String to long long int : %d\n", b);
   double c = atof(str3);
   printf("String to long int : %f\n", c);
   printf("The first random value : %d\n", rand());
   printf("The second random value : %d", rand());
   return 0;
}输出结果
这是输出
String to long int : 53875 String to long long int : 367587938 String to long int : 53875.884300 The first random value : 1804289383 The second random value : 846930886