All pastes #910890 Raw Edit

sizetest.cpp

public cpp v1 · immutable
·published 2008-02-20 08:39 UTC
rendered paste body
#include <iostream>#include <string>using namespace std;class MyClass {        private:        int x;        int y;        int z;        int a;        int b;        int c;        int d;        public:        MyClass( int nx, int ny, int nz ) {                x = nx;                y = ny;                z = nz;        }};int main( int argc, char** argv ) {        int x = 4;        long y = 40000000000L;        MyClass mc = MyClass(3, 6, 9);        cout << "x is " << sizeof(x) << " bytes long." << endl;        cout << "y is " << sizeof(y) << " bytes long." << endl;        cout << "mc is " << sizeof(mc) << " bytes long." << endl;        return 0;}//OUTPUT: //x is 4 bytes long.//y is 8 bytes long.//mc is 28 bytes long.