按照C ++标准,int,long类型的大小是多少?
在这里,我们将看到C++中int和long类型数据的大小。大小取决于系统体系结构和操作系统。
因此,在32位系统中,标准为ILP32。在此标准中,int,long和指针变量为32位。
对于64位系统,有两种变体。对于Linux操作系统,标准为LP64。这里long和指针是64位的,而int是32位的。对于Windows操作系统,标准为LLP64。longlong是64位,而int和long是32位。
示例
#include <iostream>
using namespace std;
int main() {
cout << "Size of int: " << sizeof(int) * 8 << " bits" << endl;
cout << "Size of long: " << sizeof(long) * 8 << " bits" <<endl;
cout << "Size of long long: " << sizeof(long long) * 8 << " bits"<< endl;
}输出结果
Size of int: 32 bits Size of long: 32 bits Size of long long: 64 bits
热门推荐
1 训练狗狗工作
4 狗狗定点排便训练
5 狗狗训练吠叫
6 狗狗尿垫训练
7 狗狗训练座
8 狗狗训练攻略
9 狗狗训练记
10 做训练狗狗
11 狗狗训练词
12 狗狗谢谢怎么训练
13 狗狗训练如厕
14 狗狗太凶怎么训练
15 狗狗训练它
16 狗狗克制训练
17 训练基地狗狗
18 怎么样训练狗狗大小硬