enum - 列舉
enum direction
{
North, // 0
South, // 1
East, // 2
West // 3
};
可搭配 typedef
typedef enum direction Direction;
enum direction
{
North,
South,
East,
West
};
int main(void)
{
Direction dest = East;
return 0;
}
參考資料 :
https://michaelchen.tech/c-programming/enumeration/
0 意見:
張貼留言