why is 11111111+1 + to -1?
why is 11111111+1 + to -1?
Is there a typo in that question? I dont understand what you are asking.
You mean binary or decimal or what...
If binary then all I can figure is that when the left most bit of a signed variable is 1 that means its negitive. Thats why and unsigned char can hold 0-255 and a signed char like -127 to 127 ( er something like that )
What is C++?
>why is 11111111+1 + to -1?
Whether this is true depends on what universe you're from. Would you care to be more specific please?
My best code is written with the delete key.
well i think he is using some old 16 bit dos compilers... when he does 11111111+1 the limit of the variable is reached and the bit pattern is read as -1.....
i agree with vicious
this is binary arithmetic as i suppose
it is like this
11111111 + 1 = 100000001
since in binary most significant bit represents a sign
it gets set to 1 and read as
1------------->for sign ---->i.e.-ve
00000001----->read as 1
combine it as -1
i hope u understood
and anybody correct me if i am wrong
been a long time since binary arithmetic
Syra
Amateur's urge to master C/C++