C++ Identifiers
Overview
In this tutorial, we will learn about C++ identifiers. A C++ identifier is a name used to identify a variable, class, function, or other user-defined items in the program.
Naming Rules
The rules of the C++ language determine the valid identifiers. There are some rules for valid or qualified identifiers.
The first character of an identifier must be alphabetic[A to Z] or [a to z] or an underscore( _ ). The first character cannot be a numeric digit i.e [0 to 9].
Note that C++ is a case-sensitive programming language. For example, studentNo and STUDENTNO are two different identifiers in C++.
C++ reserved words cannot be used for identifiers. For example, throw is a reserved word. We cannot have an identifier with this name.
Examples
Some valid and legal identifiers are as follows:
- i
- abc
- studentName
- testing_docs
- _temp
Some unqualified identifiers are as follows:
- 9name
- else
—
C++ Tutorials
C++ Tutorials on this website:
https://www.testingdocs.com/c-coding-tutorials/
For more information on the current ISO C++ standard
https://isocpp.org/std/the-standard