C language-data type and presentation range

Source: Internet
Author: User

In the C language, data types are used to declare parameters, return values of variables or functions of different types. The data type determines how much space is consumed by the storage and how the storage is read and written.

About the representation range width of a data type
data type range dimensions are optimized by the compiler vendor based on the hardware and system platform on which the target machine is running, but must comply with ISO/ANSI regulations :
1.short at least 16 bits;
2.int at least as long as short;
3.long at least 32 bits, and at least as long as int;
4.long Long at least 64 bits, and at least as long as long;
Double at least 64 bits, long double with a precision of not less than double

*p.s. The sizeof () operator can be used to get the exact number of bytes of memory consumed by the data type on a particular hardware system platform (representing the range).


The following is a list of the common "data type" representation ranges:
① Basic types:
1. Numeric type
1.1 Integer Type "signed (default)/unsigned"

 Short( Short int)-Short Integer (2 bytes) indicates range:-32768..32767Or0..65535int-Shaping (4 bytes) indicates the range:-2147483648..2147483647Or0..4294967295(4 bytes)Long(Long int)-Long Integer (4 bytes) indicates range:-2147483648..2147483647Or0..4294967295(4 bytes)Long Long(Long Long int)-Long Long Integer (8 bytes) indicates range:-9223372036854775808..9223372036854775807Or0..18446744073709551615(Vc99 New, VC + +6.0 not supported)

1.2 Floating-point type "signed (always)"

float -Single precision (4 bytes) indicates range:1.2E-383.4E+38  accuracy: 6 to 7 decimal digits Double -double precision (8 bytes) indicates the range: 2.3E-308 1.7E+308 accuracy: 15 to 16 decimal places Long Double -long precision (16 bytes) indicates range:3.4E-49321.1E+4932 accuracy: 18 to 19 decimal places


2. Character type "signed/unsigned * Warning: The default symbol type is set by the compiler!" 】

Char -character type (1 bytes) indicates range:-1270255


② constructed type
1. Array []

2. struct structs

3. Consortium Union

4. Enumerate enum


③ pointer type *


④ empty type void

C language-data type and presentation range

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.