标识符:
在程序中使用的变量名、常量名、函数名、标号、语句块等统称为标识符。
定义规则:
- 只能包含数字,字母,下划线,可以以字母a~z,A~Z或者下划线开头。
- 不能以数字开头。
- 不能是C语言中保留的关键字,因为其有特殊意义,不能作为标识符。
- 标识符的长度,C89规定31个字符以内,C99规定63个字符以内。
(如:
类型说明保留字:int, long, short, float, double, char, unsigned, signed, const,
void, volatile, enum,struct, union
语句定义保留字:if, else, goto, switch, case, do, while, for, continue, break, return,
default, typedef
存储类说明保留字:auto, register, static, extern
)
*以上关键字归类来自:https://blog.csdn.net/hitwhylz/article/details/9391633
例如:a, x, -b, s*, BOOK_4, sum7
其中,a, x, BOOK_4, sum7为合法标识符,-b, s*为非法标识符。
如有问题欢迎指出!
2021/9/25