Use only signed char and unsigned char types for the storage and use of numeric values because it is the only portable way to guarantee the signedness of the character types.
So lets play with the example and try to understand:
int main()
{
char c = 200; //by default it a signed char type.
int i = 1000;
printf("i/c = %d\n", i/c);
return 0;
}
Here the output will be -17 not 5 because of signed data, as we know a char can store a data of size 1byte ie. 8bits.
Basically its range to store a number is form "-128 to 127" so here we want to assing a number 200 which is more than its range. So it will store -56 instead of 200.
Its simple, a char range is -128 to 127. so if you want to store a numbe which is greater than 127. it will store the number next fit .( -128 , -127 ......-1, 0, 1, ---- 126, 127, -128 ....so on)
Change the char to unsigned char in the above program and see the result, the output will be 5.
for unsigned char the range is (0 to 255).