because char, signed char and unsigned char are different types
and it's implementation defined whether char is signed or not.
More specifically, the integer literal 0xff has type int, which
is converted to char that, being signed in your compiler
implementation, acquires the integer value -1. Then, in the
expression "*y==0xff" where you're comparing a char and an int,
integer promotion rules kick in and the char is converted to the
int -1, giving the observed result. That would be handy in some
cases but also quite confusing since the other integers (short,
int...) are signed. There are a lot of pitfalls in C/C++ and
integer promotion will create nasty surprises for you in many
other cases as well. It's just to get used to it... Debugging is
twice as hard as writing the code in the first place. Therefore,
if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it. - Brian W. Kernighan
why doesnt the following program work as expected: Two
guidelines that can help to p