Posted On: Jan 09, 2021
Constant pointer refers to a particular variable in its lifetime while a Constant variable always contain same value in its life time.
A constant variable is a variable to which value can be assigned only once. Any try to change its value through any operation or reassignment would result in an error.
A constant pointer is a pointer pointing to fix memory location. Here the value of location can be changed but the pointer will remain to point to that memory location only. Any attempt to modify the pointer or any try to alter the location it is pointing will result in an error.
in constant pointer, we can store address of variable, but after initialisation we can not change address in that constant pointer variable..but we can change the value of variable. In constant variable, we can only store value at initialisation, after initialisation we cannot change value of variable
Never Miss an Articles from us.