mardi 25 mai 2021

value is equal to zero as far as if concerned when when value printed it is not - c [closed]

I have a variable declared byte ir;, of type typedef unsigned char byte;, and I set it to ir = mem[ip];. When I use printf("%d\n", (ir & 0b10000000));, I get "128" printed on the screen, great. when I do if ((ir & 0b10000000) != 0), it goes to the else. Why is that?

Aucun commentaire:

Enregistrer un commentaire