我不斷收到「未知類型名‘地方’即使我寫的枚舉正確的,我不能看到我在做什麼錯誤的錯誤。謝謝枚舉錯誤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