智能体还是对话框?大模型应用选型指南
2026/11/4 13:55:36
好,这一块是C 语言入门的“地基”,也是考试和面试经常考的基础点。
我按概念 → 规则 → 分类 → 示例 → 常见错误给你一篇清晰好记的说明。
关键字是 C 语言中已经被系统“预留”的单词,具有固定语义,不能作为变量名使用。
👉 关键字是语言的一部分,由编译器识别。
auto break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while📌关键字全部是小写,区分大小写
❌ 错误示例:
intint=5;// 错误:int 是关键字用户标识符是程序员自己定义的名字,用来标识变量、函数、数组、结构体等。
例如:
intage;floattotal_score;intadd(inta,intb);✅ 合法规则:
❌ 非法示例:
int2num;// 错:数字开头inttotal-1;// 错:非法字符intfor;// 错:关键字| 对比项 | 关键字 | 用户标识符 |
|---|---|---|
| 定义者 | 语言 | 程序员 |
| 含义 | 固定 | 自定义 |
| 是否可修改 | ❌ | ✅ |
| 使用范围 | 语法结构 | 变量 / 函数等 |
虽然编译器不强制,但工程中非常重要:
inttotal_count;floatavg_score;👉 小写 + 下划线(snake_case)
#defineMAX_SIZE100👉 全大写
structstudent_info{intid;charname[20];};intcharfloatdoublevoidifelseswitchcaseforwhiledobreakcontinueautostaticexternregistersizeoftypedefstructunionenumintchengji;// 不推荐intInt;// 合法,但极不推荐inta,b,c;// 可读性差关键字是系统保留字,有固定含义;标识符由用户定义,用于命名变量、函数等。
_count 2num for sum_1✔ 合法:_count,sum_1
关键字是 C 语言保留字,不能作为名字;用户标识符是程序员自定义的名称,需遵循命名规则。
如果你愿意,我可以继续帮你:
你是刚学 C,还是准备期末 / 考试?