C语言(一)Code::Blocks环境下基本数据类型所占的字节数统计【64位OS】

#include <stdio.h>
#include <stdlib.h>
int main()
{
    printf("int          = %d Bytes\n",sizeof(int));
    printf("short        = %d Bytes\n",sizeof(short));
    printf("long         = %d Bytes\n",sizeof(long));
    printf("unsigned     = %d Bytes\n",sizeof(unsigned));
    printf("float        = %d Bytes\n",sizeof(float));
    printf("double       = %d Bytes\n",sizeof(double));
    printf("long double  = %d Bytes\n",sizeof(long double));
    printf("char         = %d Bytes\n",sizeof(char));
    printf("unsigned char      = %d Bytes\n",sizeof(unsigned char));
    printf("unsigned short int = %d Bytes\n",sizeof(unsigned short int));
    printf("unsigned long int  = %d Bytes\n",sizeof(unsigned long int));
    printf("char*   = %d Bytes\n",sizeof(char*));
    printf("int*    = %d Bytes\n",sizeof(int*));
    printf("double* = %d Bytes\n",sizeof(double*));
    printf("long*   = %d Bytes\n",sizeof(long*));
    return 0;
}

运行结果


猜你喜欢

转载自blog.csdn.net/qq_40818798/article/details/79608334