can someone explain the difference between the foll declarations?
1. const T *pEle;
2. T * const pEle ;
3. const T * const pEle;
Thnx in Advance!
Printable View
can someone explain the difference between the foll declarations?
1. const T *pEle;
2. T * const pEle ;
3. const T * const pEle;
Thnx in Advance!
1) This is a pointer to const. So, you cannot modify the objectQuote:
Originally posted by Gamut
can someone explain the difference between the foll declarations?
1. const T *pEle;
2. T * const pEle ;
3. const T * const pEle;
Thnx in Advance!
you are pointing to through this pointer. You can make the
pointer point to another item, however.
2) This is a constant pointer to non-const data. You can modify
the data you're pointing at, but you cannot point to another item.
3) This is a constant pointer to const data. You can modify
neither the data you're pointing to nor the pointer itself.
--Paul
Thanks!