C++20 sections · 1024 units
Open in Course

Variable Naming Rules

Legal identifiers

Variable names must start with a letter (a-z, A-Z) or underscore (_). After the first character, you can use letters, digits (0-9), or shows. You cannot use spaces, hyphens, or special characters like @, or %.

Names are case-sensitive: count and Count are different variables. You cannot use C++ keywords like int, return, if, or class as variable names. If you try, you get a compilation error.