- 编译时替换 (compile-time substitution)
- 末尾不用加
;
#define TAXRATE 0.015
c_
或k_
表示常量 (不常用)
其它例子:
#define BEEP '\a'
#define TEE 'T'
#define ESC '\033'
#define OOPS "Now you have done it!"
4.3.1 const 限定符
C90 新增 const 关键字, 只读用
const int MONTHS = 12;
4.3.2 明示常量
- C 库中用
#define
定义的东西 - 在 C 中, 用 const 声明的是变量
使用例子, 注意, 编译器要支持 C99 才能识别 LLONG_MIN: