C++學習程式碼--sizeof

winjack11發表於2009-06-26

#include<iostream>

using namespace std;

int main() {
    cout << "The size of bool is: " << sizeof(bool) << endl;
    cout << "The size of char is: " << sizeof(char) << endl;
    cout << "The size of int is: " << sizeof(int) << endl;
    cout << "The size of long is: " << sizeof(long) << endl;
    cout << "The size of float is: " << sizeof(float) << endl;
    cout << "The size of double is: " << sizeof(double) << endl;
    return 0;
}

相關文章