Search⌘ K

Identifiers in C++

Explore how to properly name identifiers in C++ by learning the rules for valid characters, case sensitivity, and avoiding reserved keywords. Understand common mistakes that cause errors and gain best coding practices for creating meaningful variable names to write clearer and error-free programs.

Identifiers

A variable in C++ is given a unique name that is known as an identifier.

✏️ Best coding practice: Use descriptive and meaningful names for the variables to make the code self-explanatory.

Rules for naming a variable

The general rules for naming a variable are:

  • An identifier can only contain uppercase alphabets (A to Z), lowercase alphabets (a to
...