This appears to work because the 2 sting literals are identical, so there really is only one of them, and the compiler assigns a single pointer to it. So the pointer is equal to itself, obviously. But doing comparisons like that, even if they sometimes work, is dangerous and can lead to subtle bugs. @PaulRB's version from post #3 is much safer.