In C, what is the following specified to do?
if ("" == "")
{
printf("Empty strings are equal\n");
}
I have a compiler on hand that tells me that ""
is indeed equal to ""
. But is this equality guaranteed?
Edit: I understand perfectly well how pointer comparison and string comparison work in C. What I'm asking is what behavior, if any, is specified in the C standard for compile-time constant empty strings. My belief is that the strings are not guaranteed to be equal, but in practice usually will be equal since all const empty strings will be interned to the same address. But I want to know if anyone can provide a definitive reference