signed char is an integer type that is smaller than int which means it can't hold as big and small values as int can. signed char is always one byte while int is usually 4 bytes. If you want to know the max and min values of signed char you can use std::numeric_limits.
int main ()
std::cout << "maximum value of signed char: "
std::cout << "minimum value of signed char: "
std::cout << "maximum value of int: "
std::cout << "minimum value of int: "
Note that I had to cast the signed char to an int before printing it to avoid that it's printed as a character symbol.
A letter is always stored as a number. It's how you use that number that makes the difference. Normally you would use char instead of signedchar to store letters because that's the type that the standard library functions expect.
I understand that, probelm is I cant imagine signed char(s) just because I cant imagine negative ascii value...I am not sure if I explained the problem well, my q qas simply , if I operate with char type variable in my program, how do I decide if to make it char or signed char type...problem is formula above, because I simply don't understnad what is acutlaly happening in there..
probelm is I cant imagine signed char(s) just because I cant imagine negative ascii value
signedchar and unsignedchar are simply signed and unsigned values, just like ints which can also be signed or unsigned, except they are stored in 8 bits. They do not have to represent an ASCII value. The choice of a signed or unsigned char verses an int made when the size of storage is critical. Whether signed or unsigned depends on whether the value can represent a negative number.
The char type is distinct from both signed char and unsigned char. Only the char type should ever be used for holding characters - the implementation may chose for it to be either signed or unsigned, and you should not rely on one or the other. In all cases however, they all store numbers. Characters are numbers.