|
-
October 29th, 2002, 04:42 PM
#1
pointer delcaration
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!
-
October 29th, 2002, 05:01 PM
#2
Re: pointer delcaration
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!
1) This is a pointer to const. So, you cannot modify the object
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
-
October 29th, 2002, 05:16 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|