的聲明我有一個非常簡單的C代碼:誤差枚舉
#include<stdio.h>
int main()
{
enum boolean{true,false};
boolean bl=false;
if(bl==false)
printf("This is the false value of boool\n");
boolean bl1=true;
if(bl1==true)
{
printf("This is the true value of boool\n");
}
return 0;
}
我只是想用枚舉類型的變量。但它給以下錯誤:
tryit4.c:5: error: ‘boolean’ undeclared (first use in this function)
tryit4.c:5: error: (Each undeclared identifier is reported only once
tryit4.c:5: error: for each function it appears in.)
tryit4.c:5: error: expected ‘;’ before ‘bl’
tryit4.c:6: error: ‘bl’ undeclared (first use in this function)
tryit4.c:8: error: expected ‘;’ before ‘bl1’
tryit4.c:9: error: ‘bl1’ undeclared (first use in this function)
我沒有看到任何理由。你能解釋一下可能的原因嗎?
有些gyz可能有太多的空閒時間,沒有比在互聯網上生氣更好的事情了。 – 2009-12-15 19:44:38
@mawia:點擊你的用戶名,選擇「活動」,然後瀏覽你所提出的所有問題,並從每個問題中選擇一個最佳答案。 – wallyk 2009-12-15 19:48:22
感謝所有的答覆! – mawia 2009-12-15 20:01:24