In terms of direct values a regular char is used when the values are known to be between CHAR_MIN
and CHAR_MAX
while an unsigned char provides double the range on the positive end. For example, if CHAR_BIT
is 8, the range of regular char
is only guaranteed to be [0, 127] (because it can be signed or unsigned) while unsigned char
will be [0, 255] and signed char
will be [-127, 127].
In terms of what it's used for, the standards allow objects of POD (plain old data) to be directly converted to an array of unsigned char. This allows you to examine the representation and bit patterns of the object. The same guarantee of safe type punning doesn't exist for char or signed char.