Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What data type does uint16 refer to?

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what kind of data type uint16 refers to, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

Uint16 is a 16-bit unsigned integer; integers have both signed and signed types. Integer variables declared by default are signed types. If you want to declare an unsigned type, you need to precede the type with unsigned.

Operating environment of this article: Windows7 system, DELL G3 computer

What is the data type of uint16?

Uint16 is a 16-bit unsigned integer and uint8 is an 8-bit unsigned integer

There are two types of integer types, unsigned (unsigned) and signed (signed). By default, integer variables declared are signed types (char is a bit special). If you need to declare an unsigned type, you need to precede the type with unsigned. When it is impossible to take a negative value, it can be defined as unsigned. In some underlying embedded programming, the data is generally unsigned.

Related introduction:

The conversion between signed Integer and unsigned Integer in negative number

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

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

That is, the underlying bit representation of casting unsigned int to int or converting int to unsigned int remains the same. In other words, even after-1 is converted to unsigned int, its representation in memory remains unchanged.

The same storage representation may correspond to different data for the application, for example, 1111Magi 1111Magne111111 it means-1 for signed numbers, but for unsigned numbers, it means UMax (because there are no signed bits, just as the inverse complements of positive numbers are themselves, and the highest bit does not represent symbolic bits), but their underlying storage is the same.

The above is all the content of the article "what data type does uint16 refer to". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report