enum box{pencil,pen};//這里你就定義了一個枚舉類型的變量叫box,這個枚舉變量內含有兩個元素也稱枚舉元素在這里是pencil和pen,分別表示鉛筆和鋼筆。
enum box{pencil,pen};
enum box box2;//或者簡寫成box box2;
enum {pencil,pen}box,box2; //在聲明的同時進行定義!
enum box{pencil=1,pen=2};
enum box{pencil=3,pen};//這里pen就是4系統將自動進行pen=4的定義賦值操作!
新聞熱點
疑難解答