C++中有多少個關鍵字?
C++總共有95個保留字。C++的保留字可以方便地分成幾組。第一組包括那些也存在於C程式語言中並被沿用到C++中的保留字,共有32個。
另外還有30個保留字在C中不存在,因此是C++的新增保留字。
有11個C++保留字在使用標準ASCII字元集時並非必需,但它們被新增進來是為了提供一些C++運算子更易讀的替代方案,並方便使用缺少C++所需字元的字元集進行程式設計。
以下是所有這些保留字的列表:
| alignas (自C++11) | alignof (自C++11) | and |
| and_eq | asm | atomic_cancel (TM TS) |
| atomic_commit (TM TS) | atomic_noexcept (TM TS) | auto(1) |
| bitand | bitor | bool |
| break | case | catch |
| char | char16_t (自C++11) | char32_t (自C++11) |
| class(1) | compl | concept (自C++20) |
| const | constexpr (自C++11) | const_cast |
| continue | co_await (coroutines TS) | co_return (coroutines TS) |
| co_yield (coroutines TS) | decltype (自C++11) | default(1) |
| delete(1) | do | double |
| dynamic_cast | else | enum |
| explicit | export(1) | extern(1) |
| false | float | for |
| friend | goto | if |
| import (modules TS) | inline(1) | int |
| long | module (modules TS) | mutable(1) |
| namespace | new | noexcept (自C++11) |
| not | not_eq | nullptr (自C++11) |
| operator | or | or_eq |
| private | protected | public |
| register(2) | reinterpret_cast | requires (自C++20) |
| return | short | signed |
| sizeof(1) | static | static_assert (自C++11) |
| static_cast | struct(1) | switch |
| synchronized (TM TS) | template | this |
| thread_local (自C++11) | throw | true |
| try | typedef | typeid |
| typename | union | unsigned |
| using(1) | virtual | void |
| volatile | wchar_t | while |
| xor | xor_eq |
廣告
資料結構
網路
關係資料庫管理系統 (RDBMS)
作業系統
Java
iOS
HTML
CSS
Android
Python
C程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP