#include
int main() { ... }
#include 後**必須跟隨標頭檔名稱**,如 #include <stdio.h> 或 #include "myheader.h"。空白行導致預處理器語法錯誤。
#include <stdio.h>
int main() {
int i = 8, k = 5 * i * i;
printf("%d\n", k);
return 0;
}
| 標頭檔 | 用途 |
|---|---|
| <stdio.h> | 輸入輸出 (printf, scanf) |
| <stdlib.h> | 記憶體管理、轉換 (malloc, atoi) |
| <string.h> | 字串操作 (strcpy, strlen) |
| <math.h> | 數學函數 (sin, sqrt) |