Open In App

C++ Keywords

Last Updated : 01 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Keywords are the reserved words that have special meanings in the C++ language. They are the words that have special meaning in the language. C++ uses keywords for a specifying the components of the language, such as void, int, public, etc. They can’t be used for a variable name, function name or any other identifiers.

The total number of keywords in C++ are 93 up to C++ 23 specification. Below is the table for all C++ keywords:

alignas alignof and and_eq asm
auto bitand bitor bool break
case catch char char8_t char16_t
char32_t class compl concept const
consteval constexpr constinit const_cast continue
co_await co_return co_yield decltype default
delete do double dynamic_cast else
enum explicit export extern false
final float for friend goto
if inline int long mutable
namespace new noexcept not not_eq
nullptr operator or or_eq private
protected public register reinterpret_cast requires
return short signed sizeof static
static_assert static_cast struct switch template
this thread_local throw true try
typedef typeid typename union unsigned
using virtual void volatile wchar_t
while xor xor_eq

Note: The number of keywords C++ has evolved over time as new features were added to the language. For example, C++ 98 had 63 keywords, C++ 11 had 84 keywords, C++

Keywords vs Identifiers

So, there are some properties of keywords that distinguish keywords from identifiers. They listed in the below table

Keywords  Identifiers
Keywords are predefined/reserved words  identifiers are the values used to define different programming items like a variable, integers, structures, and unions.
It defines the type of entity. It classifies the name of the entity.
A keyword contains only alphabetical characters,  an identifier can consist of alphabetical characters, digits, and underscores.
It should be lowercase. It can be both upper and lowercase.
No special symbols or punctuations are used in keywords and identifiers.  No special symbols or punctuations are used in keywords and identifiers.  The only underscore can be used in an identifier.
Example: int, char, while, do. Example: Geeks_for_Geeks, GFG, Gfg1.


Next Article
Article Tags :
Practice Tags :

Similar Reads