C++ Keywords

  • C++ language contains some reserved words having some special meaning called keywords.
  • Meaning of each keyword is fixed. We cannot change the meaning of keywords.
  • We cannot use any of the keywords as the identifier and if we use any keyword as identifier then we will get error.
  • In C++ language all the keywords are written in small case letters.
  • Following table lists all the keywords available in C++:

A list of 30 Keywords in C++ Language which are not available in C language are given below.

asm dynamic_cast namespace reinterpret_cast bool
explicit new static_cast false catch
operator template friend private class
this inline public throw const_cast
delete mutable protected true try
typeid typename using virtual wchar_t

Identifiers

  • Identifiers are the name given to the various programming elements like variables, array, functions and structures etc. In simple words, identifiers are used to give the name for elements or it is used to identify the elements of the program which we use in the program uniquely.
  • In C++ for writing the identifiers we have to follow some rules as given below:
  • Identifier can use the alphabets, digits and underscore.
  • Identifier begins with the alphabets or underscores (_).
  • Identifier cannot begin with the digits (0-9).
  • Keyword cannot be used as an identifier.
  • For ANSI (American National Standard Institute) C++ maximum length of identifier is 32 but many compiler support more than 32 character long and it is also depended on the operating system which we use.
  • Identifiers cannot contain punctuation special symbols or characters such as @, !, &, ^, # etc.
  • Following are some examples of valid and invalid identifiers: