Signed integer data and unsigned data types

There are two types of integers: unsigned and signed;
  by default, the integer variables declared are signed types (char is a bit special), if you need to declare an unsigned type, you need to specify the type Prepend unsigned.
  Unsigned numbers only represent the size, the highest bit of signed numbers (the highest bit represents the sign bit in the binary case), under the same operating system , the relationship between the maximum value of signed numbers and unsigned numbers in size is 2x+1(x Represents the maximum value of a signed number, and 2x+1 represents the maximum value of an unsigned number).
  The size of the data range represented by the two is the same, but the range is different.
  The difference between unsigned integers and signed integers is that the range of positive numbers that unsigned types can store is twice as large as that of signed integers, because signed types store the sign in the highest bit, while unsigned types all store numbers .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326168989&siteId=291194637