I'm trying to compare two Char Pointers:
char * x;
char * y;
x = "Hesham";
y = "Hesham";
printf("%d %d \n", &x, &y);
if(x==y)
{
printf("=\n");
}
else
{
printf("!=\n");
}
The execution result is :
2293368 2293360
=
1 - How come the two pointers are of different addressees and the operation == returns true ?
2 - Why didn't the compiler store the string literal Hesham just once and use its address twice for x and y ?