There's also another issue here: signed vs unsigned char. Without knowing which compiler and OS are being used, you can't tell whether plain char is signed or unsigned.
More specifically: the literal 'ע' (assume it's the Greek letter tau) stands for the numeric constant that is reserved for that letter. It may be larger than 8 bits. By contrast, initializing a char variable with 'ע' enforces truncation to 8-bits. Once the original numeric value has been truncated to 8 bits, you cannot expand it to its original value, so the cout expression that seeminly prints int merely prints the truncated value. Perhaps an example will illustrate this:
Code:
char s = 1000; //truncation
cout <<(int) s<<endl; //you won't see 1000 here!
cout<<1000<<endl;
Bookmarks