C++ Identifiers

In C++, every variable, function, and object needs a unique name—these are called identifiers. They help programmers reference and manipulate stored values efficiently.

Tutorials dojo strip



Choosing Identifiers

Identifiers can be short (x, y) or descriptive (engineCapacity, totalMileage). Using clear and meaningful names improves code readability.

Example of Good vs. Vague Naming:

C++




Rules for Naming Identifiers

When creating identifiers, follow these guidelines:

  • Allowed: Letters (A-Z, a-z), digits (0-9), and underscores (_).
  • Must start with a letter or an underscore (_).
  • Case-sensitive: enginePower and EnginePower are different identifiers.
  • Cannot contain spaces or special characters (!, #, %, etc.).
  • Reserved words (such as int, double, return) cannot be used as identifiers.
Tutorials dojo strip