c++基本タイプサイズ

863 ワード

#include  <iostream>
#include <windows.h>
using namespace std;

struct hehe{
	char a;
	int b;
	char c;
};

//c++      
int main()
{
	cout << "  :" << endl;
	cout << sizeof(byte) << endl;  //1
	cout << sizeof(short) << endl;  //2
	cout << sizeof(int) << endl; //4
	cout << sizeof(long) << endl; //4

	cout << "    :" << endl;
	cout << sizeof(float) << endl; //4
	cout << sizeof(double) << endl;//8

	cout << "    :" << endl;
	cout << sizeof(boolean) << endl;//1
	cout << "    :" << endl;
	cout << sizeof(char) << endl;//1

	cout << "   :" << endl;
	cout << sizeof(hehe) << endl;//12

	getchar();
	return 0;
}