C++中sizeof关键字
基础知识
- 语法
sizeof (数据类型 或 变量)
测试源代码
/*
时间:2021.02.10
内容:sizeof关键字的用法
*/
/*
语法:sizeof (数据类型 / 变量)
*/
#include <iostream>
using namespace std;
int main()
{
float a = 0;
double b = 0;
cout << sizeof(int) << endl;
cout << sizeof(long) << endl;
cout << sizeof(a) << endl;
cout << sizeof(b) << endl;
system("pause");
return 0;
}
// KEEP CALM AND CARRY ON