c++ 数据类型长度

 

#include <iostream>
using namespace std;
 
int main() 
{    
    cout << "char: " << sizeof(char) << " 字节" << endl;
    cout << "int: " << sizeof(int) << " 字节" << endl;
    cout << "float: " << sizeof(float) << " 字节" << endl;
    cout << "double: " << sizeof(double) << " 字节" << endl;
 
    return 0;
}

 

posted @ 2019-06-05 09:38  anobscureretreat  阅读(463)  评论(0编辑  收藏  举报