32/64位下面的基本数据类型的大小

  1 // Test64.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2 //
  3 
  4 #include <iostream>
  5 
  6 int main()
  7 {
  8     printf("char size = %d\n", sizeof(char));
  9     printf("unsigned char size = %d\n", sizeof(unsigned char));
 10     printf("short size = %d\n", sizeof(short));
 11     printf("unsigned short size = %d\n", sizeof(unsigned short));
 12     printf("int size = %d\n", sizeof(int));
 13     printf("unsigned int size = %d\n", sizeof(unsigned int));
 14     printf("long size = %d\n", sizeof(long));
 15     printf("unsigned long size = %d\n", sizeof(unsigned long));
 16     printf("long long size = %d\n", sizeof(long long));
 17     printf("float size = %d\n", sizeof(float));
 18     printf("long float size = %d\n", sizeof(long float));
 19     printf("double size = %d\n", sizeof(double));
 20     printf("long double size = %d\n", sizeof(long double));
 21 
 22 
 23     printf("char* size = %d\n", sizeof(char*));
 24     printf("short* size = %d\n", sizeof(short*));
 25     printf("int* size = %d\n", sizeof(int*));
 26     printf("long* size = %d\n", sizeof(long*));
 27     printf("float* size = %d\n", sizeof(float*));
 28     printf("double* size = %d\n", sizeof(double*));
 29 
 30 }
 31 

32位下的:

image


64位下的:

image

posted on 2020-09-21 16:44  thinkinc999  阅读(218)  评论(0编辑  收藏  举报

导航