三种定义常量的方法
1 #include2 3 //1. 预编译 4 #define PI 3.14 5 6 int main(void) 7 { 8 //2. const关键字 9 const int LENGTH = 100;10 11 //3. 枚举类型12 enum color {13 RED,14 GREEN,15 BLUE16 }; 17 printf("pi = %f\n", PI);18 printf("length = %d\n", LENGTH);19 printf("red = %d\n", RED);20 printf("green = %d\n", GREEN);21 printf("blue = %d\n", BLUE);22 }