It leads to undefined behaviour when you modify a constant string. The compiler reserves the right to store them in any way it sees fit, including re-using constant strings that are the same so only one gets stored in memory. You should consider a constant string to be read only.