Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - 8-bit unsigned number representation range
8-bit unsigned number representation range
An 8-bit unsigned number represents the range of 0-255.

Unsigned numbers are relative to signed numbers, that is to say, all binary numbers of the whole machine word length represent numerical numbers, which is equivalent to the absolute value of numbers.

Unsigned numbers are binary, and the range of table numbers of unsigned numbers is non-negative. All binaries represent numerical values, and there are no sign bits. C supports signed and unsigned number operations of all plastic data types. Although the C standard does not specify some representations of signed numbers, almost all machines use two's complement.

Usually, most numbers are signed by default, and C also allows conversion between unsigned numbers and signed numbers. The conversion principle is that the basic bit representation remains unchanged. Therefore, on the two's complement machine, when converting from unsigned number to signed number, the effect is to apply U2Tw, and when converting from signed number to unsigned number, the function T2Uw is applied, where W represents the number of digits of data type.

When performing an operation, if one of its operands is signed and the other is unsigned, then C will implicitly convert the signed parameter into an unsigned number and assume that both numbers are non-negative to perform the operation.

In computers, numerical types are divided into integer types or real types, in which integer types are divided into unsigned types or signed types, while real types are only signed types. Character types are also divided into signed and unsigned types.

Signed number: it is a number that distinguishes symbols, with+and-. Such as +5,-6; Char data range:-127,+127; Unsigned number: a number that does not distinguish between symbols and symbols, and has no sign bit. Char data range: 0-255;

Source code: the absolute value of this number is converted into the corresponding binary number. (value consisting of 0 and 1) For positive integers, the sign bit is 0, followed by the binary representation of the true value; For negative integers, the sign bit is 1, followed by the binary representation of the absolute value of the truth.