Constant Pointer:- It is type of pointer whose address cannot be modified after first time initialization. Ex:- #include<stdio.h> int main() { int var = 10, var2 = 20; int *const ptr = &var; ptr = &var2; /* error cant change read only ptr is constant*/ *ptr = 30; /* value can be changed */ printf(“ptr = %d\n”,*ptr); return 0; } In this program ptr is constant which cannot hold the other addresses but value can be modified. Pointer to a constant:- It is type of pointer in which the data pointed cannot be modified. Ex:- #include<stdio.h> int main() ...
Happy learning.