C++基本データ型バイト数

1131 ワード

#include <iostream>
using namespace std;

int main() {
	cout << "Size of bool = " << sizeof(bool) << endl;
	cout << "Size of char = " << sizeof(char) << endl;
	cout << "Size of short = " << sizeof(short) << endl;
	cout << "Size of unsigned short = " << sizeof(unsigned short) << endl;
	cout << "Size of int = " << sizeof(int) << endl;
	cout << "Size of unsigned int = " << sizeof(unsigned int) << endl;
	cout << "Size of long = " << sizeof(long) << endl;
	cout << "Size of unsigned long = " << sizeof(unsigned long) << endl;
	cout << "Size of float = " << sizeof(float) << endl;
	cout << "Size of double = " << sizeof(double) << endl;
	cout << "Size of long double = " << sizeof(long double) << endl;
	cout << "Size of long long = " << sizeof(long long) << endl;

	return 0;
}