科目名稱:程式設計 | 開課系所:資訊工程 學系 | 任課教師 |
吳坤熹 |
||
系所別: |
年級: |
學號: |
姓名: |
考試日期 |
2013.4.16 |
// Memory alignment
#pragma pack(8)
#include <iostream>
using std::endl;
using std::cout;
int main()
{
class C1
{
public:
int a;
char b;
int c;
};
class C2
{
public:
short a1;
short a2;
char b;
short c1;
short c2;
};
cout << "Size of C1 is " << sizeof(C1) << endl;
cout << "Size of C2 is " << sizeof(C2) << endl;
return 0;
}