C/C ++ Data Type

Source: Internet
Author: User

The C language contains five basic data types:Void,Integer,Float,Double, AndChar.

Type Description
Void Null type
Int Integer
Float Floating Point Type
Double Double Precision Floating Point Type
Char Character Type

C ++ defines two other basic data types:BoolAndWchar_t.

Type Description
Bool Boolean Type; Value: true or false
Wchar_t Wide character type
Type Modifier

some basic data types can be signed , unsigned , short , and long . when the type modifier is used separately, the default type is int . the following table lists all possible data types:

Bool
Char
Unsigned char
Signed Char
Int
Unsigned int
Signed int
Short int
Unsigned short int
Signed short int
Long int
Signed long int
Unsigned long int
Float
Double
Long double
Wchar_t
Type and value range

the size of the basic data type and the data range that can be expressed are related to the compiler and hardware platform. "cfloat" (or "float. H ") header files often define the maximum and minimum values of the data that can be expressed by the basic data type. you can also use sizeof to obtain the type size (number of bytes ). however, many platforms use standard data types, such. int and float usually occupy 32 bits, and char occupies 8 bits, double usually occupies 64 bits. bools is usually implemented in 8 bits.

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.