Lamefif said:
how can the computer tell the difference between the two?
i mean a byte is 8 bit can be 1 or 0
11111111 = 255 unsigned byte
10000000 = -128 or 128 ?
Different programming is used for signed and unsigned. The assembly
language of the processor typically provides two kinds of branch
instructions. For unsigned data a branch opcode checks the carry flag
(which is kind of like a 9th bit after an arithmetic operation). For signed
checks another branch opcode checks the sign bit, which is the 8th bit of
the byte. That is why C++ has both signed and unsigned types: It affects the
code that is generated to test arithmetic results.