变量
- 为什么需要变量
内存地址不好记,怎么办?
通过内存中房间的别名找到数据存储的位置!
- 标识符
标识符命名要符合一定的规则。
- 变量不能与C++关键字冲突
否则会出现以下错误:
[Error] multiple types in one declaration
[Error] declaration does not declare anything [-fpermissive]
C++关键字有:
asm auto case char const
bool break catch class continue
default delete dynamic_cast do else
double enum extern float for
friend false goto if inline
int long new operator overload
private protected public register return
sizeof short signed switch static
struct true typeid this template
throw try typedef union unsigned
virtual void volatile while
- 变量的声明
变量类型+变量名称+数值