When a particular string literal appears multiple times in a source file, the compiler may choose to have all instances of that literal point to the same place.
Section 6.4.5 of the C standard, which describes String Literals, states the following:
7 It is unspecified whether these arrays are distinct provided their elements have the appropriate values. If the
program attempts to modify such an array, the behavior is
undefined.
Where "unspecified behavior" is defined in section 3.4.4 as:
use of an unspecified value, or other behavior where this
International Standard provides two or more possibilities and imposes
no further requirements on which is chosen in any instance
In your case, the string literal "First"
appears twice in the source. So the compiler uses the same instance of the literal for both, resulting in str1
and str3
pointing to the same instance.
As stated above, this behavior is not guaranteed. The two instances of "First"
could be distinct from each other, resulting in str1
and str3
pointing to different places. Whether two identical instances of a string literal reside in the same place is unspecified.