keyword and identifiers in c++ language

  • There are 63 keywords currently defined for Standard C++.
  • Early versions of C++ defined the overload keyword, but it is obsolete.
  • Keep in mind that C++ is a case-sensitive language, and it requires that all keywords be in lowercase.
asm else new this
auto enum operator throw
bool explicit private true
break export protected try
case extern public typedef
catch false register typeid
char float reinterpret_cast typename
class for return union
const friend short unsigned
const_cast goto signed using
continue if sizeof virtual
default inline static void
delete int static_cast volatile
do long struct wchar_t
double mutable switch while
dynamic_cast namespace template  

C++ Identifiers

  • In C++, an identifier is a name assigned to a function, variable, or any other user-defined item.
  • Identifiers can be from one to several characters long.
  • Variable names can start with any letter of the alphabet or an underscore. Next comes a letter, a digit, or an underscore.
  • The underscore can be used to enhance the readability of a variable name, as in line_count.
  • Uppercase and lowercase are seen as different; that is, to C++, myvar and MyVar are separate names.

Identifiers have the following form:

  • Identifiers must contain at least one character.
  • The first character must be an alphabetic letter (upper or lower case) or the underscore.
  • The remaining characters (if any) may be alphabetic characters (upper or lower case), the underscore, or a digit.
  • No other characters (including spaces) are permitted in identifiers.
  • A reserved word cannot be used as an identifier.