✅ 목표 (Goal)

앞서 include로 인해 중복 정의되는 문제를 헤더가드를 통해 해결해 보았다.

✅ 헤더 가드를 적용한 예제

#include "horse.h"
#include "donkey.h"

int main() {
    neigh();
    hee_haw();
    return (0);
}
#ifndef __DONKEY_H__ // (1) 헤더 가드 적용
#define __DONKEY_H__

#include "horse.h"

void hee_haw() { // 당나귀, 히호 
	neigh();
}

#endif // (2) 까먹지 말자
#ifndef __HORSE_H__
#define __HORSE_H__

void neigh() { // 말, 히힝
} 

#endif