You will know it by looking at the content of the const chapter. Top-level constants refer to constants whose contents are not allowed to be modified, such as const int* p; p is an integer pointer, and the pointer of the integer variable it points to cannot be modified. The const modifier is right-associative, so the const here modifies int, indicating that the content cannot be modified. Underlying constants refer to constants whose values can be modified, but whose addresses cannot be modified. For example, int* const p; The right side of const is a pointer, so this statement defines a pointer that cannot point to other memory areas, but the value of this memory area can be modified
To put it simply: Whether the pointer can be changed is a top-level const; Whether the thing pointed to by the pointer can be changed is a bottom-level const. Generally during the type derivation process, the top-level const will be ignored, while the bottom-level const is retained. It is allowed to assign top-level const variables to non-top-level const variables, but not if the underlying const is different. Different underlying consts are equivalent to different types.
You will know it by looking at the content of the const chapter. Top-level constants refer to constants whose contents are not allowed to be modified, such as const int* p; p is an integer pointer, and the pointer of the integer variable it points to cannot be modified. The const modifier is right-associative, so the const here modifies int, indicating that the content cannot be modified.
Underlying constants refer to constants whose values can be modified, but whose addresses cannot be modified. For example, int* const p; The right side of const is a pointer, so this statement defines a pointer that cannot point to other memory areas, but the value of this memory area can be modified
To put it simply:
Whether the pointer can be changed is a top-level const;
Whether the thing pointed to by the pointer can be changed is a bottom-level const.
Generally during the type derivation process, the top-level const will be ignored, while the bottom-level const is retained.
It is allowed to assign top-level const variables to non-top-level const variables, but not if the underlying const is different. Different underlying consts are equivalent to different types.