scanf v.s. assign string directively
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *s = "Hi!";
char *t = "Hi!";
char *x = malloc(5);
char *y = malloc(5);
printf("x: ");
scanf("%s", x);
printf("y: ");
scanf("%s", y);
if (s == t)
{
puts("s, t: Same");
}
else
{
puts("s, t: Different");
}
if (x == y)
{
puts("x, y: Same");
}
else
{
puts("x, y: Different");
}
}INFO