Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Numerical range of shaping in c language
Numerical range of shaping in c language
0 to 65535.

For example:

Unsigned a;

a = 5;

Or: unsigned int a;; ;

a = 5;

In the 16 bit system, an int can store data in the range of -32768~32767, while an unsigned int can store data in the range of 0~65535. In a computer, integers are stored in the form of complement.

System usage

The unsigned number only represents the size, and the highest bit of the signed number (in the case of binary, the highest bit represents the signed bit). Under the same operating system, the relationship between the maximum value of signed number and unsigned number is 2*x+ 1. They represent the same data range, but the range is different.

Supports signed and unsigned numeric operations of all plastic data types. Although the C standard does not specify some representation 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.