C Data Type Summary

Source: Internet
Author: User

Address: http://blog.csdn.net/weiqubo/article/details/6914967

I. Data Types The data type is a way to express data in the specified form, Different data types occupy different spaces. . For ease of learning, I specially sorted out the data type classification structure of C language. For example, I should also understand the following points for data types: 1. Integer Data int can have Modifiers Short, long, and long. The Int value can be omitted. , The default Integer Data constant is int ( # Add, four types in total, int and short int , Long int, long int ). 2. Integer Data int can be 10 (default), 16 (starting with 0x), and 8 (starting with 0. For example:
8 indicates a decimal integer of 8.
08 indicates an octal integer of 8
0x8 indicates hexadecimal integer 83, integer, and floating-point data. You can add signed and unsigned modifiers to indicate whether the data is signed. The data is signed by default. If you do not want to carry the symbol, the unsigned modifier is used. 4. Floating-point data can contain decimal places (. 6 indicates that it can contain six decimal places). By default, floating-point data is treated as a double type. 5. Integer and floating point constants can contain type descriptions (the type description is case insensitive ): For example:
8l, long type
8ll, long type
8llu or 8ull indicates the unsigned long type.
56.0 indicates Double Type
56.0f or 56. F indicates float type, but 56f is incorrect.
56.0l indicates the data prefix of Long Double Type 6 and Integer constants. Summary: 0 and 0x, which indicate octal and hexadecimal respectively. 7. Summary of data suffixes of Integer constants: l, ll; U. 8. Summary of floating point constant data suffixes: F, L, and U. 9. Scientific notation can be used to represent floating point data. For example:
13.1e9 represents the population of China, multiplied by 13.1 by the 9 power of 10. Ii. bytes occupied by basic data Different computing systems also have different representation of the length of basic data types. The following is a summary of the length of each data type in a 32-bit computer system: Char 1 byte
Short 2 bytes
Int 4 bytes
Long 4 bytes
Long Long 8 bytes
Float 4 bytes
Double 8 bytes
Long Double 12 bytes If you want to obtain the length of the data of a specific system, you can use the sizeof operator. , Such as sizeof (INT ); 3. Constants When it comes to data types, they are naturally associated with variables and constants. A variable represents the amount that a value can change. The variable must be defined before use. The concept of constants is Program During execution, the value does not change. constants can be used directly. Constants can be divided into: 1. Direct constants: 10, 23.0f, and 234ll. 2. Symbolic constants: There are two types of symbolic constants: macro definition and const statement Definition. For example: # define PI 3.14
Const float Pi = 3.14;

End

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.