Why is there a symbol number 0XFFFF FFFF 1? __ Default

Source: Internet
Author: User
0XFFFF FFFF If it represents a unsigned int data then its value is 4 294 967 295, which is the maximum value that the unsigned integer can represent. 0XFFFF FFFF If it represents a signed int data then its leftmost one is 1, that is, it must be a negative number.  This value is-1.  Why. The data in the 1.C language is represented in memory, and the data can be read differently because of the way it is read.   The same data is read as int and char, and the result is different, and the result may be different if read by signed and unsigned. The 2.C language data is represented in memory using binary notation, because unsigned data does not need to vacate the leftmost one to indicate positive or negative, and it is because of this extra bit that we know that this is equivalent to moving the data left one position in the binary, expanding twice times.  So unsigned data can store a range of values one times greater than the number of symbols. 3. Although the C language uses binary data in memory, there is one point: the computer uses its complement to store the data.   That is, a number to convert it into binary and then convert to the complement, is the final in memory appearance. So the above question has the answer: 0X FFFF FFFF If it is a signed number, because its highest bit is 1, so the number is negative. Simple storage in memory in the form of 1111 1111 1111 1111 1111 1111 1111 1111, this is the complement, then the original code is what. According to the rules we know to subtract the number from the binary 1, that is, subtract 0000 0000 0000 0000 0000 0000 0000 0001, get 1111 1111 1111 1111 1111 1111 1111, and then press for reverse, get 1110 0000 0000 0000 0000 0000 0000 0001, this is the original code----that is, the number of binary representations, this number is-1.


1 is negative 0 for maximum positive 0x7fff 0111 max negative 0xFFFF 1111 min negative 0x8000 1000
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.