系统相关
首页 > 系统相关> > 常见数据类型在codeblocks编译环境下占用内存空间的大小

常见数据类型在codeblocks编译环境下占用内存空间的大小

作者:互联网

#include<stdio.h>
int main()
{
    printf("char 类型变量占用 %d 个字节\n", sizeof(char));
    printf("unsigned char 类型变量占用 %d 个字节\n", sizeof(unsigned char));
    printf("short 类型变量占用 %d 个字节\n", sizeof(short));
    printf("unsigned int 类型变量占用 %d 个字节\n", sizeof(unsigned int));
    printf("int 类型变量占用 %d 个字节\n", sizeof(int));
    printf("long 类型变量占用 %d 个字节\n", sizeof(long));
    printf("long long 类型变量占用 %d 个字节\n", sizeof(long long));
    printf("float 类型变量占用 %d 个字节\n", sizeof(float));
    printf("double 类型变量占用 %d 个字节\n", sizeof(double));
    printf("long double 类型变量占用 %d 个字节\n", sizeof(long double));
    return 0;
}

 

 

标签:字节,占用,数据类型,内存空间,long,printf,sizeof,codeblocks,变量
来源: https://blog.csdn.net/weixin_42048463/article/details/114707258