"Tagore" <> wrote in message
news:6cf7d23b-8a63-4992-a007-...
> hi,
>
> #include <stdio.h>
> int main(void){
> char *s="LET";
> char *t="LET";
> if(s==t)
> printf("same");
> else
> printf("different");
> return 0;
> }
>
> In above code, output is "same".
> but I expected output to be "different". I think that s and t points
> to string literals present at different addresses.
> Can any one please help me in understanding its output.
Because the literals are identical, perhaps only a single copy is used.
--
Bartc
|