const 修饰变量 const修饰变量 该变量成为常变量,不能被修改。 例一:const修饰一般变量(以整型变量为例) const int num = 100; int* p = # num = 200;//用这种方式修改变量会报错,走不通。 *p = 200;