# 1.6 关键字

**作用：**&#x5173;键字是C++中预先保留的单词（标识符）

* 在定义变量或者常量时候，不要用关键字

&#x20;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          |          |

{% hint style="info" %}
提示：在给变量或者常量起名称时候，不要用C++的关键字，否则会产生歧义.
{% endhint %}
