sizeof.cpp

来自「C++ sample code, for the book: C++ blac」· C++ 代码 · 共 20 行

CPP
20
字号
#include <iostream>
using namespace std;

int main()
{
    int integer = 4; 

    cout << "The variable named integer is " << sizeof (integer) << " bytes long" << endl;

    cout << endl;
    cout << "The char type is " << sizeof (char) << " byte long" << endl;
    cout << "The short type is " << sizeof (short) << " bytes long" << endl;
    cout << "The int type is " << sizeof (int) << " bytes long" << endl;
    cout << "The long type is " << sizeof (long) << " bytes long" << endl;
    cout << endl;

    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?