#include <stdio.h>
int main(){
char a[] = "bar";
char b[] = "bar";
printf("%d\n", (a==b));
char* x = "bar";
char* y = "bar";
printf("%d\n", (x==y));
}
Output :
0
1
I know we can't compare C char arrays using the == operator as it compares memory locations, but why does it work in the second case ?