Naming C++ Variables
I'm learning c++.
MY question is, is this a valid variable name?
int @variableName
I want to include the '@' symbol.
Thank you. 开发者_开发百科
No, it's not a valid variable name. C++ only allows letters, digits and the underscore character, and the variable name cannot start with a digit.
No. In C++, and most languages, the only valid characters in variable names are a-z,A-Z, 0-9, and _. (And cannot start with a number).
int variableName; //fine
int _variable //fine
int 8variable //not fine
int @variable //not fine
精彩评论