Pages

Sunday, October 6, 2013

C pointer to const and const pointer

const int * ptr1 --> pointer to a constant. You cannot change the value of integer ptr1 is pointing to but you can change ptr1 to point to something else
int const * ptr2 --> Same thing
int * const ptr3 --> const pointer. You can change the value of integer ptr3 is pointing to but cannot change ptr3 to point to something else
http://duramecho.com/ComputerInformation/WhyHowCppConst.html

No comments:

Post a Comment