Chinaunix首页 | 论坛 | 博客
  • 博客访问: 157624
  • 博文数量: 76
  • 博客积分: 1513
  • 博客等级: 上尉
  • 技术积分: 755
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-25 15:15
文章分类

全部博文(76)

文章存档

2012年(2)

2011年(74)

我的朋友

分类: C/C++

2011-11-25 20:37:47

sizeof(char) = 1 bytes.

sizeof(short int) = 2 bytes.

sizeof(int) = 4 bytes.

sizeof(long int) = 4 bytes.

sizeof(long long int) = 8 bytes.

sizeof(unsigned long long int) = 8 bytes.

sizeof(float) = 4 bytes.

sizeof(double) = 8 bytes.

请按任意键继续. . .

 

计算机:WIN7、32位操作系统

源码:

  1. #include <iostream>

  2. #include <windows.h>

  3. using namespace std;

  4.  

  5. int main()

  6. {

  7.     cout << "sizeof(char) = " << sizeof(char) << " bytes." << endl;

  8.     

  9.     cout << "sizeof(short int) = " << sizeof(short int) << " bytes." << endl;

  10.     cout << "sizeof(int) = " << sizeof(int) << " bytes." << endl;

  11.     cout << "sizeof(long int) = " << sizeof(long int) << " bytes." << endl;

  12.     cout << "sizeof(long long int) = " << sizeof(long long int) << " bytes." << endl;

  13.     cout << "sizeof(unsigned long long int) = " << sizeof(unsigned long long int) << " bytes." << endl;

  14.     

  15.     cout << "sizeof(float) = " << sizeof(float) << " bytes." << endl;

  16.     cout << "sizeof(double) = " << sizeof(double) << " bytes." << endl;

  17.  

  18.     //getchar();

  19.     system("pause");

  20.     return 0;

  21. }

阅读(648) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~