The use of const is very tricky in C.
char *p; // P points to any char, you can modify the char
const char *p; // P can point to any char, you can't modify the char via *p
char * const p = &a; // P only points to address &a and connot be changed. However the char content can be modified via *p.
const char * const p; = &b; //P only points to address &b and cannot be changed. You can't modify the char content via *p.
The code snipet above illustrated three way to use const with pointer. This still looks very confusing. There is a rule to check where const applies to.
const applies to the type left to it. If it is the first, then it applies to the type right of it. Use this rule again to check three use of const above.
const char *p; //Const is at first, it applies to the char, thus the content(*p) is const, and can not be mutated.
char * const p; //Const applies to its left (*), thus it means the pointer itself is immutable and cannot be changed.
const char * const p; // First const means (*p) cannot be changed. Secode const means pointer itself is immutable.