why is 11111111+1 + to -1?

Printable View

- 10-02-2004NiVaGquestion
why is 11111111+1 + to -1?

- 10-02-2004bithub
Is there a typo in that question? I dont understand what you are asking.

- 10-02-2004Vicious
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 ) - 10-02-2004Prelude
>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? - 10-02-2004vasanth
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.....

- 10-02-2004aldajlo
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