开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜