It's best to compare in the following way: char x = -1; char y = 0xff; if ((unsigned char)x = (unsigned char)y) ... ... so before comparing, cast both to unsigned char. This because you do not know (because it's undefined by the language definition) if char is unsigned or not.