ManticMoo.COM -> Jeff's Articles -> Programming Articles -> Are chars in C signed or unsigned?

Are chars in C signed or unsigned?

by Jeffrey P. Bigham

A. The answer turns out to be that they're both! The C standard doesn't specify whether chars are signed or unsigned, although it seems that it most modern implementations they are signed. This may have to do with ASCII only needing 128 values (see here). You can test your platform out by declaring something like that following and then compiling:

char c = -1;
If this gives you a warning from the compiler, then your chars are unsigned. If no warning appears, then your chars are signed.

ManticMoo.COM -> Jeff's Articles -> Programming Articles -> Are chars in C signed or unsigned?