[7급 국가직 자료구조론 2020년 9번]

다음 C 언어 프로그램의 출력 결과는? (단, 배열 h의 시작 주소는 6487296이고, 자료형 int와 float는 4바이트의 크기를 가진다)
#include <stdio.h>

int main()
{
	struct human {
		char sextype;
		union t {
			char children[3];
			char beard[3];
		} u;
		int age;
		struct date {
			int month;
			int day;
			int year;
		} dob;
		int personalID;
		float salary;
	} h[10];
	printf("%d, %d, %d", sizeof(struct human), 
		&h[3].u.children[0] - &h[0].sextype, 		&h[5].u.beard[1] - &h[0].sextype);
}
자료구조론
  1. ①28, 85, 142
  2. ②28, 86, 143
  3. ③31, 94, 157
  4. ④31, 95, 158

선지를 골라 바로 채점해 보세요.

정답 ①

출처: 인사혁신처 공개 기출(공공데이터포털, 이용허락 제한 없음)

신고가 접수됐습니다. 감사합니다.

오류 신고