32位电脑“内置类型"所占空间大小

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u010183589/article/details/50511581
<pre name="code" class="cpp">#include  <iostream>
using std::cout;	using std::cin; using std::endl;

#include <string>
using std::string;	
#include <cstring>
#include <vector>
using std::vector;

#include <iterator>
using std::begin; using std::end;

#include <cstddef>
using std::size_t; 


int main()
{
	int ia;
	cout << "the bytes of int is " << sizeof ia << endl;
	short sa;
	cout << "the bytes of short is " << sizeof sa << endl;
	long  la;
	cout << "the bytes of long is " << sizeof la << endl;
	long long lla;
	cout << "the bytes of long long is " << sizeof lla << endl;
	float fa;
	cout << "the bytes of float is " << sizeof fa << endl;
	double da;
	cout << "the bytes of double is " << sizeof da << endl;
	long double lda;
	cout << "the bytes of long double is " << sizeof lda << endl;
	return 0;
	
}



输出

the bytes of int is 4
the bytes of short is 2
the bytes of long is 4
the bytes of long long is 8
the bytes of float is 4
the bytes of double is 8
the bytes of long double is 12


展开阅读全文

没有更多推荐了,返回首页