void main()、gets),課本用新標準(int main()、fgets)。typeof、__attribute__、#pragma),老師習慣用特定編譯器特性。const 正確性等工程細節。int* p vs int *p、迴圈變數宣告位置。int main、const、size_t、錯誤碼)。| 項目 | 老舊/教學常見 | 現代標準/工程推薦 |
|---|---|---|
| main 回傳 | void main() | int main(void) / int main(int argc, char *argv[]) |
| 字串輸入 | gets(str) | fgets(str, sizeof(str), stdin) + 去換行 |
| 記憶體配置 | malloc(n) 不檢查 | void *p = malloc(n); if (!p) handle_error(); |
| 巨集常數 | #define N 100 | enum { N = 100 }; 或 const int N = 100; |
| 布林值 | int flag = 1; | #include |