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