C + + premier Second class post-title

Source: Internet
Author: User

2.1:int, long, short types of differences

the short, int, and long types all represent integer values, and the size of the storage space is different. In general, the short type is half the machine word length, the int type is a machine word length, and the long type is one or two machine word lengths.

The difference between 2.2:unsigned and signed

signed denotes an integral type with a sign, with a value of 128 to 127;

unsigned denotes an integer with no sign, with a value of 0 to 255;

2.3: If the short type occupies 16 bits on a machine, what is the maximum number that can be assigned to the short type? What is the maximum number of unsigned short types?

2^16=65536, so the short type should contain the sign, -32728~32727, the maximum number is 32727;unsigned short does not contain the sign, so the value is 0~65535, the maximum number is 65535;

2.4: What is the assigned value when assigning a value of 100 000 to a 16-bit unsigned short object?

Direct binary calculation, 32 or 65568 (over value) or larger.

2.5:What is the difference between a float type and a double type?

float represents the single-precision type, and double represents the type of doubles. The general float type is represented by a single word (32 bits) , and the double type is represented by two characters (64 bits) .

C + + premier Second class post-title

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.