- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
- C++ Advanced
- C++ Files and Streams
- C++ Exception Handling
- C++ Dynamic Memory
- C++ Namespaces
- C++ Templates
- C++ Preprocessor
- C++ Signal Handling
- C++ Multithreading
- C++ Web Programming
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)|
- Related Articles
- Keywords in C#
- Reserved keywords in C++?
- Important Keywords in C#
- Variables and Keywords in C
- What are reserved keywords in C#?
- What are contextual keywords in C#?
- char vs string keywords in C#
- How many keywords are there in C++?
- Tokens vs Identifiers vs Keywords in C++
- Try/catch/finally/throw keywords in C#
- Go Keywords
- What are signed and unsigned keywords in C++?
- Keywords in Java
- Keywords in Python
- What are the different types of keywords in C language?