- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Keywords are those words whose meaning is already defined by Compiler. These keywords cannot be used as an identifier. Note that keywords are the collection of reserved words and predefined identifiers. Predefined identifiers are identifiers that are defined by the compiler but can be changed in meaning by the user.
For example, you could declare a variable called main inside your main function, initialize it, and then print out its value (but ONLY do that to verify that you can!). On the other hand, you could not do this with a variable named else. The difference is that else is a reserved word, while main is "only" a predefined identifier.
There are a total of 95 reserved words in C++. The reserved words of C++ may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C++. There are 32 of these.
There are another 30 reserved words that were not in C, are therefore new to C++ programming language.
There are 11 C++ reserved words that are not essential when the standard ASCII character set is being used, but they have been added to provide readable alternatives for a few of the C++ operators, and also to facilitate programming with character sets that lack characters required by C++.
Here is a list of all these reserved words:
|alignas (since C++11)||double||reinterpret_cast|
|alignof (since C++11)||dynamic_cast||requires (since C++20)|
|atomic_cancel (TM TS)||export(1)||sizeof(1)|
|atomic_commit (TM TS)||extern(1)||static|
|atomic_noexcept (TM TS)||false||static_assert (since C++11)|
|bool||goto||synchronized (TM TS)|
|case||import (modules TS)||this|
|catch||inline(1)||thread_local (since C++11)|
|char16_t (since C++11)||long||true|
|char32_t (since C++11)||module (modules TS)||try|
|concept (since C++20)||new||typename|
|const||noexcept (since C++11)||union|
|constexpr (since C++11)||not||unsigned|
|continue||nullptr (since C++11)||virtual|
|co_await (coroutines TS)||operator||void|
|co_return (coroutines TS)||or||volatile|
|co_yield (coroutines TS)||or_eq||wchar_t|
|decltype (since C++11)||private||while|
| do|| register(2)|
- Keywords in C#
- Keywords in Python
- Keywords in Java
- Reserved keywords in C++?
- Important Keywords in C#
- Variables and Keywords in C
- What are Reserved Keywords in Python?
- What are contextual keywords in C#?
- What are reserved keywords in C#?
- char vs string keywords in C#
- List of Keywords in Python Programming
- IMPORTING, EXPORTING and CHANGING Keywords in ABAP
- How many keywords are there in C++?
- Tokens vs Identifiers vs Keywords in C++
- Try/catch/finally/throw keywords in C#