C++
主要考察变量类型的字节知识
- 人肉记忆,short 2 bytes | int 4 bytes | long 8 bytes | long long 8 bytes.
- 利用sizeof(date type)输出;
代码如下:#include<iostream> using namespace std; int main(){ cout<<"The size of short is "<< sizeof(short)<<" bytes."<<endl; cout<<"The size of int is "<<sizeof(int)<<" bytes."<<endl; cout<<"The size of long is "<<sizeof(long)<<" bytes."<<endl; cout<<"The size of long long is "<<sizeof(long long)<<" bytes."<<endl; return 0; }
ps: 这里'<<'符号 'main'打错了,查了半天,要注意; 回头看一下具体的类型知识