Keywords and Identifiers in C++

Previous
Next

C++ Keywords:

  • A reserved word with special meaning
  • Keyword is a program that can be used directly to do some operations.
  • A list of keywords as shown below
Alignasdecltypenamespacestructalignofdefaultnewswitch
Anddeletenoexcepttemplateand_eqdonotthis
Asmdoublenot_eqthread_localautodynamic_castnullptrthrow
Bitandelseoperatortruebitorenumortry
Boolexplicitor_eqtypedefbreakexportprivatetypeid
Caseexternprotectedtypenamecatchfalsepublicunion
Charfloatregisterunsignedchar16_tforusingfriend
Returnvirtualclassgotoshortvoidcomplif
Volatileconstinlinesizeofconstexprintstaticwhil
Longstatic_assertxorcontinuemutablestatic_castxor_eqsigned

C++ Identifiers

  • Every Data member has unique identity in C++ Program
  • Identities applied to Variables, Classes, Functions and other entities
  • Identifier must follow rules
    • Identifiers can be composed of letters, digits, and the underscore character.
    • It has no limit on name length.
    • It must begin with either a letter or an underscore.
    • It is case-sensitive.
    • We cannot use keywords as identifiers.
    • We can choose any name as an identifier if we follow the above rules. However, we should give meaningful names to the identifier that makes sense.
Invalid IdentifierBad IdentifierGood Identifier
Total pointsT_pointstotalPoint
1listlist_1list1
Floatn_floatfloatNumber
Previous
Next

Courses Enquiry Form