1/28/24, 9:49 PM C++ Identifiers
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO [Link] C
Ads by
Stop seeing this ad Why this ad?
C++ Identifiers
❮ Previous Next ❯
C++ Identifiers
All C++ variables must be identified with unique names.
These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum,
totalVolume).
Note: It is recommended to use descriptive names in order to create understandable
and maintainable code:
Example
// Good
int minutesPerHour = 60;
// OK, but not so easy to understand what m actually is
int m = 60;
Try it Yourself »
The general rules for naming variables are:
[Link] 1/4
1/28/24, 9:49 PM C++ Identifiers
Names can contain letters, digits and underscores
Tutorials
Names must Exercises
begin Services
with a letter
or an underscore (_) Sign Up Log in
Names are case sensitive ( myVar and myvar are different variables)
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO [Link] C
Names cannot contain whitespaces or special characters like !, #, %, etc.
Reserved words (like C++ keywords, such as int ) cannot be used as names
❮ Previous Log in to track progress Next ❯
ADVERTISEMENT
Ads by
Stop seeing this
ad
Why this ad?
[Link] 2/4
1/28/24, 9:49 PM C++ Identifiers
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO [Link] C
COLOR PICKER
ADVERTISEMENT ADVERTISEMENT
SPACES UPGRADE AD-FREE
NEWSLETTER GET CERTIFIED REPORT ERROR
Top Tutorials Top References
HTML Tutorial HTML Reference
CSS Tutorial CSS Reference
JavaScript Tutorial JavaScript Reference
[Link] 3/4
1/28/24, 9:49 PM C++ Identifiers
How To Tutorial SQL Reference
SQL Tutorial
Tutorials Exercises
Python Tutorial
[Link] Tutorial
Services Python Reference
[Link] Reference
Bootstrap Reference
Sign Up Log in
HTML
CSS Bootstrap Tutorial
JAVASCRIPT SQL PYTHON PHP ReferencePHP
JAVA HOW TO [Link] C
PHP Tutorial HTML Colors
Java Tutorial Java Reference
C++ Tutorial Angular Reference
jQuery Tutorial jQuery Reference
Top Examples Get Certified
HTML Examples HTML Certificate
CSS Examples CSS Certificate
JavaScript Examples JavaScript Certificate
How To Examples Front End Certificate
SQL Examples SQL Certificate
Python Examples Python Certificate
[Link] Examples PHP Certificate
Bootstrap Examples jQuery Certificate
PHP Examples Java Certificate
Java Examples C++ Certificate
XML Examples C# Certificate
jQuery Examples XML Certificate
FORUM ABOUT
W3Schools is optimized for learning and training. Examples might be simplified to
improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we
cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of
use, cookie and privacy policy.
Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by
[Link].
[Link] 4/4