chester30, I'm surprised your code example doesn't crash my computer! you've declaired 10 char* but haven't allocated memory to them before you started sticking things into them. I guess the compiler knows to allocate enough memory to fit what ever you want to go in each char*. Interesting!

I guess the compiler knows to allocate enough memory to fit what ever you want to go in each char*.

I found this rather hard to believe, so I looked into what was really happening.
This turns out to be an artifact of c using char[] to represent strings, while allowing string constants (literals in c++). I'll simplify the example to the following:

Here the same thing occurs, and as we removed unnecessary complications, it is easier to see what is happening.Now we have a statement that does: "char *=char[]"Automatically the array of characters is converted into a pointer. So basically what we store in tab is the address of the constant "one".

The question that follows is: Do constants have memory addresses? The answer is that yes they do have memory addresses. If they did not have memory addresses, they could not be treated in the same way non-literals can. So literals are stored in memory too, and as such they do have memory addresses.

What escapes me is why there is no const-correctness forced here. Try the following code:

I don't know how this fares on other compilers, but on gcc this crashes at runtime and indeed, if you look it up you will find that "trying to modify a literal results in undefined behavior. I wonder why this is defined as such without the string literal being defined as const char[]. However, we are talking about design choices made for c rather than those made for c++.