When I run this program using MinGW, im getting output as \"=\"
#include
using namespace std;
int main()
{
char *str1 = \"Hello\";
char *
There are no guarantees that the two pointers are pointing to different memory locations. Maybe it is because optimizations, or the compiler uses its own rules... the behavior is "Implementation Defined".
According to the standard (C++11 §2.14.5 String Literals):
Whether all string literals are distinct (that is, are stored in nonoverlapping objects) is implementation defined.