Two string literals have the same pointer value?

You are right in that they are pointers. However, whether they are pointing to different locations or not depends on the implementation. It is perfectly valid for a compiler to store a string literal just once and use its address wherever it’s used in code.

Leave a Comment