得到基本数据类型的字节数

#include <iostream>
using namespace std;
void main()
{
	/*显示为所占字节数*/
	cout<<"bool:"<<sizeof(bool)<<endl;
	cout<<"char:"<<sizeof(char)<<endl;
	cout<<"signed char:"<<sizeof(signed char)<<endl;
	cout<<"unsigned char:"<<sizeof(unsigned char)<<endl;
	cout<<"wchar_t:"<<sizeof(wchar_t)<<endl;
	cout<<"short:"<<sizeof(short)<<endl;
	cout<<"unsigned short:"<<sizeof(unsigned short)<<endl;
	cout<<"int:"<<sizeof(int)<<endl;
	cout<<"unsigned int:"<<sizeof(unsigned int)<<endl;
	cout<<"long:"<<sizeof(long)<<endl;
	cout<<"unsigned long:"<<sizeof(unsigned long)<<endl;
	cout<<"float:"<<sizeof(float)<<endl;
	cout<<"double:"<<sizeof(double)<<endl;
	cout<<"long double"<<sizeof(long double)<<endl;

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-05-25
  • 2021-10-14
  • 2021-05-18
  • 2022-02-23
  • 2021-12-10
猜你喜欢
  • 2021-07-03
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-07
相关资源
相似解决方案