# C++的关键字 # 1. 关键字 ① 关键字是C++中预先保留的单词(标识符)。 ② 在定义变量或者常量的时候,不要用关键字。 ## 1.1 int关键字 ```python #include using namespace std; int main() { // int int = 10; // 错误,第二个int是关键字,不可以作为变量的名称 system("pause"); return 0; } ``` 运行结果: - 请按任意键继续. . . ## 1.2 sizeof关键字 ① sizeof关键字可以统计数据类型所占内存大小。 ② sizeof关键字,语法:sizeof ( 数据类型 / 变量 ) ```python #include using namespace std; int main() { cout << "short 类型所占内存空间为:" << sizeof(short) << endl; system("pause"); return 0; } ``` 运行结果: - short 类型所占内存空间为:2 - 请按任意键继续. . .