안난다.
#include <stdio.h>
void woof() { // 강아지,멍멍
printf("멍멍\\r\\n");
}
void meow() { // 고양이,야옹
woof();
printf("야옹\\r\\n");
}
int main() {
woof();
meow();
return (0);
}
난다. 왜?
(1)에서 meow() 함수가 정의되어 있지 않기 때문이다.
#include <stdio.h>
void woof() { // 강아지,멍멍
meow(); // (1)
printf("멍멍\\r\\n");
}
void meow() { // 고양이,야옹
printf("야옹\\r\\n");
}
int main() {
woof();
meow();
return (0);
}
아래와 같이 호출하기 전에 컴파일러에게 함수를 알려주면 된다.
#include <stdio.h>
void meow() { // 고양이,야옹
printf("야옹\\r\\n");
}
void woof() { // 강아지,멍멍
meow();
printf("멍멍\\r\\n");
}
int main() {
woof();
meow();
return (0);
}