Constant pointer:
A constant pointer is a pointer whose value (pointed address) is not modifiable. If you will try to modify the pointer value, you will get the compiler error.
A constant pointer is declared as follows :
Let’s see the below example code when you will compile the below code to get the compiler error.
Pointer to a constant:
In this scenario the value of the pointed address is constant that means we can not change the value of the address that is pointed by the pointer.
A constant pointer is declared as follows :
Let’s take a small code to illustrate a pointer to a constant: