Tutorial Study Image

Keywords and Identifiers in C++


July 20, 2022, Learn eTutorial
1535

C++ keywords

Predefined words with particular meanings to the compiler are known as keywords. For example:


int price;

 

In the above example, price is a variable of type integer, as indicated by the keyword int.

List of keywords used in c++ as we know C++ is a very case-sensitive language and all the keywords should be written in lowercase.

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

What are C++ identifiers?

Any name used to identify a variable, function, class, module, or another user-defined item is referred to as a C++ identifier. A letter from A to Z, a to Z, or an underscore (_) is used as the first character in an identification. One or more letter underscores, or numbers are then added (0 to 9).

The punctuation letters @, $, and percent are not permitted in identifiers in C++.  C++ is also known as a case-sensitive programming language  Consequently, in C++, Manpower and manpower are two separate identifiers.

An example of acceptable identifiers


ahmd ayan xyz move_name a_789