In the first example, kNumberKey
is a single non-modifiable character with a zero value. So it's not usable directly as a key (you would have to take the address of the character, like this : &kNumberKey
.
In the second example, ObjectTagKey
is a non-modifiable pointer to a string of non-modifiable characters.
What does modifiable mean in this context? If the pointer is modifiable, you can do this in your code :
ObjectTagKey = "my new key";
If the characters are modifiable, you can do this :
ObjectTagKey[3] = 'X';
Having the pointer be non-modifiable helps avoid changing it accidentally, later on in the application's development cycle when development staff has forgotten what ObjectTagKey
was used for in the first place. The same logic holds for the characters themselves. So it's safer from a software-maintenance perspective.