mardi 22 décembre 2015

Comparison always fails with char and constant

I am trying to compare the first character of a string and a hex constant to determine the type of data. But every time it fails. Can anyone explain why below comparison always fails.

char charray[] = {0xAA, 0x00, 0x02};
char ch = charray[0];
if (0xAA == ch)
{
    printf("Equal\n");
}

Aucun commentaire:

Enregistrer un commentaire