When you explicitly type @"nick" or @"1", it is a string literal that, for efficiency, the compiler is storing in the same memory location. If you created one of the strings in a different fashion, it would appear at a different memory location, such as if you built up the first string by concatenating two strings together.
Generally comparing two strings in this way is not what you want to do. Usually you want to compare the two strings for equality, and rarely want to know if they actually point to the same memory address. You should use isEqual: or isEqualToString: instead.
Asked in February 2016Viewed 3,962 timesVoted 9Answered 1 times