**作用:**关键字是C++中预先保留的单词(标识符) 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 | explicit | 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 | |
提示:在给变量或者常量起名称时候,不要用C++得关键字,否则会产生歧义。 标识符命名规则作用:C++规定给标识符(变量、常量)命名时,有一套自己的规则 - 标识符不能是关键字
- 标识符只能由字母、数字、下划线组成
- 第一个字符必须为字母或下划线
- 标识符中字母区分大小写
建议:给标识符命名时,争取做到见名知意的效果,方便自己和他人的阅读
|