C. Review

Source: Internet
Author: User

C language signed and unsigned:

In C language, all operands are automatically convertedUnsigned type

Signed int A =-110; unsigned int B = 2; cout <a + B <Endl;

For floating point numbers, float (double) is actually a signed number. The unsigned and signed prefixes cannot be added to float and double, of course, there is no conversion problem between the unsigned numbers.

 

 

The main difference between signed and unsigned integers is how to view the highest bit:
For a single-byte binary number of 01010110, the unsigned integer is 86, and the number of symbols is also 86, because the highest bit is 0, there is no difference between the two.
For binary 10101100, the unsigned number is 172, and the signed number is-84. The two are very different.

Unsigned char a =-1; cout <(unsigned);

The above output 255 should be like this:-1 is signed, it should be 11111111, and then assign this value to A. When the output is unsigned A, it is interpreted as 255.

C. Review

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.