✅ 목표 (Goal)

tpyedef 를 이용해서 “아이스아메리카노 타입”을 “아아 타입”로 재정의해보자.자.

✅ “아아”, “얼죽아”가 무엇인가요?

당근이의 커피 이야기 (Carroty’s cofee story)

🥕 당근이의 한마디

“아이스아메리카노_t” 데이터형의 이름이 너무 길기 때문에, 이를 “아아”로 줄여보자.

“얼어죽어도아이스아메리카노_t”데이터형도 “얼죽아”로 줄여보자.

struct 아이스아메리카노_t {
	// blah blah
}

typedef 아이스아메리카노_t 아아_t

아아_t 아아;
struct 얼어죽어도아이스아메리카노_t {
	// blah blah
}

얼어죽어도아이스아메리카노_t 얼어죽어도아이스아메리카노;
struct 아이스아메리카노_t {
	// blah blah
}

아이스아메리카노_t 아이스아메리카노;
struct 얼어죽어도아이스아메리카노_t {
	// blah blah
}

typedef 얼어죽어도아이스아메리카노_t 얼죽아;

얼어죽어도아이스아메리카노_t 얼어죽어도아이스아메리카노;

✅ 코딩해보자.

#include <stdio.h>
#include <stdbool.h>

struct 아이스아메리카노_t {
	unsigned int price;
};

struct 얼어죽어도아이스아메리카노_t {
	bool is_right;
};

int main() {
	struct 아이스아메리카노_t 아아;
	struct 얼어죽어도아이스아메리카노_t 얼죽아;

	아아.price = 5000;
	printf("아이스아메리카노의 가격은 %d입니다.\\r\\n", 아아.price);

	얼죽아.is_right = false;
	char answer[16] = { 0, };
	if (얼죽아.is_right == true) {
		strcpy(answer, "넵 !");
	}
	else {
		strcpy(answer, "아니오");
	}
	printf("당신은 얼죽아인가요? %s\\r\\n", answer);
}