Have a look at this code:
#include
using namespace std;
int main()
{
const char* str0 = \"Watchmen\";
const char* str1 = \"Watchmen
You surely should not rely on that behavior, but most compilers will do this. Any literal value ("Hello", 42, etc.) will be stored once, and any pointers to it will naturally resolve to that single reference.
If you find that you need to rely on that, then be safe and recode as follows:
char *watchmen = "Watchmen";
char *foo = watchmen;
char *bar = watchmen;