'-1'
is a multi-character constant, with a value that's probably out of range for char
. If you mean to use the values -1
and 0
, then remove the quotes.
For portability, if the values might be negative, you should use a type that's guaranteed to be signed (like int
or signed char
). Otherwise, you might get a surprise if you change to a compiler that gives an unsigned char
.