개인 공부/C언어 공부

C언어 코딩도장 : 51.6 암호화 헤더 크기 구하기

240 • 사공이 2020. 8. 21. 23:17

문제 : 다음 소스 코드를 완성하여 12가 출력되게 만드세요. 구조체 멤버의 이름은 마음대로 지어도 됩니다.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
 
struct EncryptionHeader {
    char flags;
    int a;
    int b;
};
 
int main()
{
    struct EncryptionHeader header;
 
    printf("%d\n"sizeof(header));
 
    return 0;
}
cs

int형 이외에도 다양한 자료형을 활용할 수도 있다.