The comparison performed compares the location of two lines, not their contents. It so happened that your compiler decided to create only one string literal containing the characters "George" . This means that the location of the string stored in name and the location of the second "George" match, so the comparison returns a non-zero value.
The compiler is not required to do this, however - it can just as easily create two different string literals with different locations, but with the same content, and then the comparison will return zero.
caf Jul 22 '13 at 7:19 2013-07-22 07:19
source share