各个类型所占字节

来源:互联网 发布:中国男性阴茎 知乎 编辑:程序博客网 时间:2024/05/20 13:18

32位系统中类型与所占的字节数的关系,通过如下程序进行测试

    #include <iostream>    using namespace std;    int main()    {    cout<<"the 32bit operation system int is "<<sizeof(int)<<endl;    cout<<"the 32bit operation system int* is "<<sizeof(int*)<<endl;    cout<<"the 32bit operation system char is "<<sizeof(char)<<endl;    cout<<"the 32bit operation system char* is "<<sizeof(char*)<<endl;    cout<<"the 32bit operation system float is "<<sizeof(float)<<endl;    cout<<"the 32bit operation system float* is "<<sizeof(float*)<<endl;    cout<<"the 32bit operation system long is "<<sizeof(long)<<endl;    cout<<"the 32bit operation system long* is "<<sizeof(long*)<<endl;    cout<<"the 32bit operation system double is "<<sizeof(double)<<endl;    cout<<"the 32bit operation system double* is "<<sizeof(double*)<<endl;    return 0;    }
0 0
原创粉丝点击