C++ Keywords and Identifiers

Keywords are the predefined words that have special significance in any language. Every keyword is reserved for a specific purpose and hence must not be used as user defined names (identifiers).

Keyword in the C++ Programming language is:-

  • Keywords are Predefined by the compiler
  • Keywords cannot be as a Variable name
  • There are 63 keywords are defined
  • Keywords are also defined as reserved words

Keyword in the C++ Programming language:

asmautoboolbreak
casecatchcharclass
constconst_castcontinuedefault
deletedodoubledynamic_cast
elseenumexportextern
exportexternfalsefloat
forfriendgotoif
inlineintlongmutable
namespacenewoperatorprivate
protectedpublicregisterreinterpret_cast
returnshortsignedsizeof
staticstatic_caststructswitch
templatethisthrowtrue
trytypedeftypeidtypename
unionunsignedusingvirtual
voidvolatilewchar_twhile
public

Identifiers

Identifiers are the names given to uniquely identify various programming elements, such as variables, arrays, functions, classes, structures, namespaces and so on. While defining identifiers in C++, programmers must follow the rules listed here.

Rules for naming identifiers

  • An identifier in an upper case is different from that in a lower case. It means identifier is case sensitive
  • Identifiers cannot be used as a Keyword
  • An identifier must start with an alphabet or underscore.
  • Identifiers must not contain any white space