In computer science, the signedness of a data type indicates whether a variable of that type is allowed to be a negative number. Specifically:
- If a numeric variable is “unsigned,” it can represent only a positive number or zero.
- If a numeric variable is “signed,” it can also represent a negative number. Because one of the bits of data is dedicated to representing “positive” or “negative”.
For instance, a signed eight-bit numeric type can represent the numbers -127 through 127. Seven of the bits are used for the binary representation of zero (0000000) through 127 (1111111. One of the bits represents whether the number is positive or negative. By contrast, an unsigned eight-bit type may represent the numbers 0 (00000000) through 255 (11111111).
Data type, Programming terms