lundi 27 janvier 2020

Comparing string with if condition [duplicate]

I am comparing string using if condition but the second if condition is failing. What will be the reason of fail and what happens in compiler level in these comparing cases?

char *c = "test";
char a[] = "test";

if(c=="test")
{
    printf("Hai\n");
    if(a=="test")
    printf("Bye\n");
}

Aucun commentaire:

Enregistrer un commentaire