C之枚举

#include<stdio.h>
#include<stdlib.h>
enum WeekDay{
  Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
};
main(){
  //
枚举,规定变量取值范围只能从预先定义好的值中选择
  enum WeekDay day = Sunday;
  printf("%d\n",day);
}

posted on 2017-02-19 13:08  LoaderMan  阅读(138)  评论(0编辑  收藏  举报

导航