Am I correct to say the difference between a signed and unsigned integer is:
- Unsigned can hold a larger positive value, and no negative value.
- Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative.
- signed integers can hold both positive and negative numbers.
Any other differences?
(in answer to the second question) By only using a sign bit (and not 2's complement), you can end up with -0. Not very pretty.
Yes.
There are different ways of representing signed integers. The easiest to visualise is to use the leftmost bit as a flag (sign and magnitude), but more common is two's complement. Both are in use in most modern microprocessors — floating point uses sign and magnitude, while integer arithmetic uses two's complement.
Yes
According to what we learned in class, signed integers can represent both positive and negative numbers, while unsigned integers are only non-negative.
For example, looking at an 8-bit number:
unsigned values
0
to255
signed values range from
-128
to127