1. has the following expression:
int a=248; b=4;
int const c=21;
const int *d=&a;
int *const e=&b;
int const *const f =&a;
The meaning of each expression is explained below
int main()
{
int a = 248, b = 4;//a和b是一般的变量
int const c = 21;//const修饰c,使得c成为常量不可修改
const int* d = &a;//*d是常量,*d代表a的内容不可修改 指针d指向谁是可改的
d = &b;//right
//*d = &b;//error
int* const e = &b;//指针e指向不可改变,*e代表的b的内容可修改是可以改变的
*e = 12;//right
//e = &a;//error
int const* const f = &a;//*f和f都不可以改变
//*f = a;//error
//f = &b;//error
}
Summary: const needs to pay attention to who it modifies, whoever is immutable, and whoever is on the right means that whoever is not modifiable