const char * myPtr = "A";
declares a pointer to a constant string. This means that you can later change myPtr to point to something different, but you cannot change the string's contents.
I.e. ++myPtr is legal, but myPtr = 'B' is illegal.
char * const myPtr = "A";
Declares a constant pointer to a string. It's sort of the opposite from above. This means that you cannot change the value of myPtr, but you can change the contents of the string.
I.e. ++myPtr is illegal, but myPtr = 'B' is legal;
const char * const myPtr = "A";
You can neither change the pointer nor the value pointed to.
P.S. Is there a way to access the newsletter from the site?
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
I'm going to try to start posting the newsletters to the site in the news and announcements section; however, this will generally be a few days after the newsletter goes out. (I will be posting last week's tomorrow....-- I'm behind).
Once at these forums, there was a thread, where one member put a question, then the one who gives the correct answer, get his turn to ask any other question and in this way the thread moved on.
Isn't it cool, if we have a thread like there. Like Brad asked first question and kirants answered correctly, now kirants asked and the one who'll answer correctly can ask the next question. (Just a suggestion )
Originally posted by Brad Jones
The differences between each of these three are..... part of the quiz question
Without even looking at the newsletter yet...I would think that the following might be part of the answer...
1. Reference - Can change the referenced object
2. Const-Reference - Can not change the referenced object
3. Const-Pointer - Can change the adress it is pointing to but not the object
4. Pointer-Const - Can change the object but no the address it is pointing to
5. Const-Pointer-Const - Can neither change the address nor the object