顶层const:指针本身是个常量。
底层const:指针所指的对象是个常量。
int nNum = 3;
int *const pNum = &nNum; // 一直指向nNum的常量指针,指向不能变。顶层const
const double dPi = 3.14159;
const double * pPi = &dPi; // 指向常量双精度常量的指针,指向的值不能变,底层const
顶层const:指针本身是个常量。
底层const:指针所指的对象是个常量。
int nNum = 3;
int *const pNum = &nNum; // 一直指向nNum的常量指针,指向不能变。顶层const
const double dPi = 3.14159;
const double * pPi = &dPi; // 指向常量双精度常量的指针,指向的值不能变,底层const