Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
What is a const pointer?
Editorial / Best Answer
Answered by: Prasad
Constant pointer is NOT pointer to constant. Constant pointer means the pointer is constant. For eg:
Constant Pointer
int * const ptr2 indicates that ptr2 is a pointer which is constant. This means that ptr2 cannot be made to point to another integer. However the integer pointed by ptr2 can be changed.
Where as a Pointer to constant is
const int * ptr1 indicates that ptr1 is a pointer that points to a constant integer. The integer is constant and cannot be changed. However, the pointer ptr1 can be made to point to some other integer.
Related Answered Questions
Related Open Questions