Difference between const. pointer and reference?

There are 3 types of const pointers:

//Data that p points to cannot be changed from p
const char* p = szBuffer;

//p cannot point to something different.  
char* const p = szBuffer;

//Both of the above restrictions apply on p
const char* const p = szBuffer;

Method #2 above is most similar to a reference.

There are key differences between references and all of the 3 types of const pointers above:

Leave a Comment