Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What are the data types of uint8 and uint 16?
What are the data types of uint8 and uint 16?
Uint8 is an 8-bit unsigned integer, and uint 16 is an 16-bit unsigned integer.

There are two types of integers: unsigned and signed. By default, all declared integer variables are signed types (char is a bit special). If you want to declare an unsigned type, you need to add the unsigned before the type. When a negative value cannot be taken, it can be defined as unsigned, and the data in some underlying embedded programming are generally unsigned.

Extended data:

Conversion between signed integer and unsigned integer and negative number

When performing an operation (such as a > here; B), if one of its operands is signed and the other is unsigned, then C language will implicitly force the signed parameter to be unsigned and assume that both numbers are non-negative to perform this operation.

Integers usually exist in the form of complement in computers. The complement of-1 (stored in 4 bytes) is11,11,65438. For most C language implementations, the general rule for dealing with the conversion between signed and unsigned numbers with the same word length is that the numerical value may change, but the bit pattern remains unchanged.

That is, convert unsigned int into int, or convert int into unsigned int, and keep it unchanged. That is to say, even after-1 is converted into unsigned int, its representation in memory remains unchanged, that is,11,11,kloc-0/.

The same storage representation can correspond to different data of the application, for example,11,1 1 1,1/65438. 111/for signed numbers, it means-1, but for unsigned numbers, it means UMax (because there is no sign bit, just like the complement of a positive number itself, the highest bit does not mean the sign bit), but their underlying storage is the same.

Baidu encyclopedia-unsigned integer