char ,signal char and unsigned char

ErnieM

Joined Apr 24, 2011
8,010
char and unsigned char are both data types in C.

Unsigned ranges between 0 and +255.

Signed ranges from -128 to +127. "char" is signed by default.

A single char (character) will fit in a char type.
 

WBahn

Joined Mar 31, 2012
24,981
char and unsigned char are both data types in C.

Unsigned ranges between 0 and +255.

Signed ranges from -128 to +127. "char" is signed by default.

A single char (character) will fit in a char type.
Whether "char" is signed or unsigned is implementation defined. If you NEED it to be signed, then you best use the "signed" modifier (which is why it exists -- if all integer types were signed by default, there would be no need for it).

Also, it must be at least 8-bits, but can be more. It must be able to hold the entire basic execution character set, represented as strictly positive values, and the entire source code character set, though it can represent those as negative values if desired.
 
Top