我不断收到“未知类型名‘地方’即使我写的枚举正确的,我不能看到我在做什么错误的错误。谢谢枚举错误C“未知类型”
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
void pass(place x);
typedef enum{
house, second
} place;
int main()
{
pass(house);
return 0;
}
void pass(place x){
if(x == house){
printf("We are in a house \n")
}else if(x == second){
printf("We live in the second house \n");
}
return;
}
如果你仔细观察前错误信息,你会看到它指向一行* befor e *实际枚举声明... – Evert
I.e.原型'void通过(place x)的原型是怎么样的呢?'当你还没有别名时''知道'place'是什么。 – WhozCraig
噢那好吧,修好了,谢谢m8 – DeadAccount