- 常量
两种定义方式:
(1)宏常量 #define 变量名 变量值
(2)const修饰的变量 const 数据类型 变量名=变量值 - 关键字
C++中预先保留的标识符
在定义变量或常量时,不要使用关键字
asm | do | if | return | typedef |
---|---|---|---|---|
auto | double | inline | short | typeid |
bool | dynamic_cast | int | signed | typename |
break | else | long | sizeof | union |
case | enum | mutable | static | unsigned |
catch | explict | namespace | static_cast | using |
char | export | new | struct | virtual |
class | extern | operator | switch | void |
const | false | private | template | volatile |
const_cast | float | protected | this | wchar_t |
continue | for | public | throw | while |
default | friend | register | true | |
delete | goto | reinterpret_cast | try |
- 标识符命名规则
不能是关键字
由字母、数字、下划线组成
第一个字符必须是下划线或字母
标识符区分大小写