Do not worry about whether the code you write contains a pointer constant or a constant pointer. First understand your code.
Let's take a look at these declaration methods:
[Cpp]
Int * pi1;
Int * pi2;
Int * pi1;
Int * pi2;
The results of the two declaration methods are the same. Both pi1 and pi2 are integer pointers. The so-called integer pointer is the pointer variable pointing to the first address of the integer array. In fact, both int * and int * describe a variable, indicating the attributes of a variable.
Continue to look down
[Cpp]
Int const * pid1;
Int const * pid1; [cpp] view plaincopyprint? Const int * pid2;
Const int * pid2;
The two statements have the same result. First, both pid1 and pid2 are pointers, (* pid1) and (* pid2) both have int attributes, so both pointers are integer pointers, because the const attribute is added, the integer (* pid1) cannot be modified.
This is a constant pointer.
Let's take a look at the following statement.
[Cpp]
Int * const pid;
Int * const pid;
The pid is a pointer, And the modifier of the pid is const. Therefore, the pid content cannot be modified. That is to say, it can only be stored once and initialized during declaration.
This is a pointer constant.
Summary:
A pointer constant is a pointer of a constant.
A constant pointer is a pointer to a constant.
In fact, after understanding the above explanation, you don't have to worry about constant pointers and pointer constants. Yes ..