My professor told me that the concepts is extremely important than programming.So today he shows us:
char c=0;
c=~c;(which is the bitwise)
so what is c=?
Since C is 00000000,and use not(~) so it is 11111111 now,but he said the answer is -1 instead of 255.Because he says it use one's complement or something~~~so,why it is -1?
(I know it can't be 255,since char is 1 byte with sign,which means it is -128~127,so 255 is out of range,so why it is -1?)
Ok,guys I know I am so stupid since for storing int ,we use two's complement notation,so 1111 1111 means -1.
but I want to know We also ues Excess notation for int,so why this case we use two's complement notation instead of Excess notation?which situations we use Excess notation? thx!



LinkBack URL
About LinkBacks



CornedBee