Consider the following:
(I'm using Visual C++ compiler) From what I have learnt, signed char must have values ranging for -127 to +127 and unsigned char from 0 to 255. And the default is signed char.. apparently??Code:signed char sign = -140; unsigned char sign = -140; char sign = -140; std::cout << sign;
But in the above code, all of them give me the same output. So what's the difference!? There has gotta be a reason why signed is the only identifier that is applicable to char data type.. I mean it's gotta serve a purpose right..
I even tried this for loop:
I changed "signed" to "unsigned" but seems both unsigned and signed char is practically THE SAME..?Code:for (int i = 1; (char)1 != (char)i+1; i++) { cout << i << " " << (signed char)i << " ;"; }
Thanks for reading!