字符内存大小

来源:互联网 发布:衣柜画图软件 编辑:程序博客网 时间:2024/06/07 12:33
    int a=1;
    char b='a';
    float c=0.1;
    double d = 0.2;
    long e = 5;
    long long f = 4;
    short g = 7;
    cout<<sizeof(a)<<endl<<sizeof(b)<<endl<<sizeof(c)<<endl
       <<sizeof(d)<<endl<<sizeof(e)<<endl<<sizeof(f)<<endl<<sizeof(g)<<endl;
对应输出为:
4
1
4
8
4
8
2
0 0
原创粉丝点击