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
=
How come the two pointers are of different addresses and the operation
==returns true?Why didn't the compiler store the string literal
Heshamjust once and use its address twice forxandy?