• 코드:
​x
 
1
#include <iostream>
2
using namespace std;
3
​
4
struct TypeSize
5
{
6
    char a;
7
    int b;
8
    double c;
9
};
10
​
11
int main(void)
12
{
13
    cout << "구조체 TypeSize의 각 멤버의 크기는 다음과 같습니다." << endl;
14
    cout << sizeof(char) << ", " << sizeof(int) << ", " << sizeof(double) << endl << endl;
15
    
16
    cout << "구조체 TypeSize의 크기는 다음과 같습니다." << endl;
17
    cout << sizeof(TypeSize);
18
    return 0;
19
}
표준입력 & 실행옵션