0% found this document useful (0 votes)
13 views

C++ Identifiers

This system sucks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

C++ Identifiers

This system sucks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

 Tutorials  Exercises  Services   Log in

HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EX

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:

Names can contain letters, digits and underscores


Names must begin with a letter or an underscore (_)
Names are case-sensitive ( myVar and myvar are different variables)
Names cannot contain whitespaces or special characters like !, #, %, etc.
Reserved words (like C++ keywords, such as int ) cannot be used as names
 Tutorials  Exercises  Services   Log in

❮ Previous
HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL Next ❯
JQUERY EX

W3schools Pathfinder
Track your progress - it's free! Sign Up Log in

COLOR PICKER

 
 Tutorials  Exercises  Services   Log in

HOW TO 
W3.CSS C
SPACES
C++ C#
UPGRADE
BOOTSTRAP
AD-FREE
REACT MYSQL JQUERY EX

NEWSLETTER GET CERTIFIED CONTACT US

Top Tutorials Top References


HTML Tutorial HTML Reference
CSS Tutorial CSS Reference
JavaScript Tutorial JavaScript Reference
How To Tutorial SQL Reference
SQL Tutorial Python Reference
Python Tutorial W3.CSS Reference
W3.CSS Tutorial Bootstrap Reference
Bootstrap Tutorial PHP Reference
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
W3.CSS 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 CLASSROOM


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 W3.CSS.

 Tutorials  Exercises  Services   Log in

HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EX

You might also like