C Data Type

Source: Internet
Author: User

The C language has five basic data types: character, integer, single-precision, double-precision, and null. Although the length and range of these types of data are compiled with the processor type and C LanguageProgramBut taking B I t as an example, the length of the integer is equal to that of the CPU. A character is usually a byte, and the exact format of the floating point value depends on the implementation. For most computers, Table 2-1 provides the length and range of five types of data.

The value of the length and range in the table is assumed that the word length of c p u is 1 6 B I t.
The C language also provides several aggregate types (aggregate types), including arrays, pointers, structures, shared bodies (Federated), bit fields, and enumeration. These complex types will be discussed in subsequent chapters.
In addition to the v o I D type, there can be various modifiers before the basic type. Modifier is used to change the meaning of the basic type, so as to more accurately adapt to the needs of various situations. Modifier:
• Signed (Signed ).
• Unsigned (unsigned ).
• Long (long character ).
• Short (short character ). Modifiers: s I g n e d, s h o r t, l o n g, and u n s I g n e d are applicable to the character and integer types, L o n g can also be used for d o u B l e (note that since long float and d o u B l e mean the same, therefore, the n s I standard deletes redundant long float ).
Table 2-2 lists all types, word widths, and ranges of combinations based on the n s I standard. Remember, in systems with a computer character length greater than 1 to 6 digits, the short int and signed Char may differ.

 

* The length and range of the table are assumed that the word length of c p u is 1 6 B I t. Because the default definition of an integer is a signed number, the use of S I n g e d is redundant, but is still allowed. Some implementations allow the use of u n s I g n e d For floating point type, such as unsigned double. However, this method reduces the scalability of the program.

Planting, so it is recommended not to use. For ease of use, the C compiler allows the abbreviated form of integer:

• Short int is abbreviated as s h o r t.
• long int is abbreviated as l o n g.
• unsigned short int is abbreviated as unsigned short.
• unsigned int is abbreviated as u n s I g n e d.
• unsigned long int is abbreviated as unsigned long.
that is, I n t can be default.

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.