天天看點

c語言:枚舉常量的用法舉例

1.程式:

#include<stdio.h>

enum os

{

  WIN,

  LINUX,

  UNIX

};

int main()

   printf("%d %d %d\N",WIN,LINUX,UNIX);

  return 0;

}

結果:

0 1 2N

             Press any key to continue

2.程式:

  WIN=1,

  UNIX=12

1 2 12N