1.const 和 define 异同优化
同:const 和 define都是修饰常量spa
异:const修饰的常量只是编译器的一种优化,它是能够经过内存地址修改const修饰的常量;而define修饰的常量任何方式都不能修改指针
2.int const a 和const int a 是同样的,都表示a 为常量内存
3.const int * a 和 int * const a编译器
const int * a: 能够看作const 修饰的是 (int * ),表示指向的内存空间为常量,更清楚的解释就是:表示这片内存是只读的,不可写; 编译
int * const a:能够看作const 修饰的是a这个指针,表示常量指针,不能随便更改常量指针(a)的指向。co