A detailed description of the data types in the C language

Source: Internet
Author: User

The C language can actually be understood as saving two data types, integers and floating-point numbers (bool type char types can be considered integer types).
But this time not from two aspects, but the char type and so on from the integer type separately said.
The description of the data type is also described in two ways of storing and printing.
Storage: 0. The number of bits of the data type is determined by the operating system, and the general system treats the bits of a char type as one byte.
1.int type
There are many types of int,
Summary for the front is called Long (short******), Signed (unsighed);
For prefix words such as short long, the C standard does not give a provision, it is implemented according to different systems.
Why should there be so many standards? A: Because of the data you use, if you use only int, there is only one representation of the number of bits in the operating system, and there is no choice of presentation data. While the important role of using short long is to make C portable, we know that long short does not specify a fixed number of digits, so it can be more portable on different systems.
Overflow situation: If overflow, it will be the first one to start again.
2.char type
The standard ASCII range is 0-127, so as long as 8 bits are represented, and of course there are expansion sets.
Char types are stored on the computer as if they were of type int (except for the number of bits). So the char type can be seen almost in storage.
3._bool type
The _bool type is introduced by C99, which can be said to be an integer type with only one representation of the number, which is more convenient to use.
4. Portable Type: Inttypes.h
This is understood as a C library that uses a macro to implement the data type of a fixed number of digits. such as: int_16t.
5.float Double Type
Floating-point numbers are completely different from integers, and can have unpredictable consequences if they are mixed in a random way.
The storage of floating-point numbers is divided into symbols. The integer part. The fractional part is stored in three parts, so it cannot be mixed with integers.
Overflow: overflowing: When a floating-point number is larger than the data type, the INF and infinity are displayed when you use printf.
Underflow: Over-precision part of the shed.
For cases where floating-point numbers are mixed with integers:
In a declaration, if a floating-point number is declared as an int variable, the decimal part of the floating-point is discarded.
If this happens in print, unpredictable conditions can occur.
My understanding of this is that the stored bits of the data are directly manipulated by the printed words, while the declaring variables are not bits stored by the manipulation variables.



Print
The C language prints direct manipulation of the stored bits of the data (not the meaning of changing the values of the data), and the various conditions that accompany the preceding are printed conditionally.

A detailed description of the data types in the C language

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.