Possible duplicate:
How are string literals compiled in C?
I wrote a little code below. In this code, I think the address of the first and second line "hello" will be compared. I'm confused. At first glance, I thought that both lines would be stored in read-only memory and therefore would have a different address. But after the execution was printed "equal."
When I saw objdump, I could not see the welcome line. I understand that I did not take a variable to save them, but where "hello" will be stored.
Will it be stored on STACK ?? Or Will it be saved in the code segment?
#include<stdio.h>
int main()
{
if ("hello" == "hello")
printf("\n equal ");
else
printf("\n not equal");
return 0;
}
if if ("hello" == "hell1"), " ".
, .
STACK??
?
, - .