I have written the following program:
#include <stdio.h>
main()
{
if("ddd" == "ddd")
printf("equal");
else
printf("not equal");
}
The output is "equal", but according to me, the output should be "not equal" because the string literals are stored in the literal pool or some read only memory (I guess it depends on OS), so both strings should have two different addresses as they are stored at different addresses in memory.
Previously, I have done the same type of example (one year back), and that time the output was "not equal". Now, could anyone tell me, is this due to a change in the C standard, or am I missing something?