Basic data types for C languages

Source: Internet
Author: User

C There are three categories of data types that languages allow .

(1) basic type . The most basic data types that cannot be divided include integer, floating point (single precision), double, character, no value, logical, and plural types. The base type typically represents a single data.

(2) construction type . A type constructed by a known base type through certain construction methods, including arrays, structs, unions, enumeration types, and so on. A constructed type typically represents a batch of data.

(3) pointer type . Pointers can point to memory addresses, access to high efficiency, to construct various forms of dynamic or recursive data structures, such as linked lists, trees and so on.

1.1 Basic data Types

1 . Base data type and its keywords

The 7 basic data types provided by the C99 standard and their corresponding keywords are shown in the table.

Data type

Key words

Data type

Key words

Character type

Char

No value type

void

Integral type

Int

Logic type

_bool

floating point ( single precision) type

Float

Plural type

_complex_imaginary

Double-precision Type

Double

Character Type : Describes a single character;

integer: Describes integers, integers are accurately represented on a computer;

floating point, double type : Describe real numbers, real numbers are generally approximate on a computer, the approximation of floating-point is relatively low, and the approximation of double-precision is relatively high.

No value type : No specific value, usually used to describe a non-formal parameter or a non-return value of the C function, as well as a non-directional pointer.

Logical: describes the logic true (its value is 1) and the logical false (its value is 0).

plural type: describes complex numbers (_complex) and pure Imaginary (_imaginary).

You must include the header file stdbool.h when you use the logical type, and you must include the header file complex.h when you use the plural type.

2 . How the base data type is stored and the range of values, the extension of the base data type

Type

Length/byte

Range of values

Storage mode

Char

1

-128~127

Signed binary complement form

[Signed]char

1

-128~127

unsigned char

1

0~255

short [int]

2

-32768~32767

unsigned short [int]

2

0~65535

Int

4

-2147483648~2147483647

Fixed-point signed binary complement form

[Signed] int

4

-2147483648~2147483647

unsigned [int]

4

0~4294967295

long [int]

4

-2147483648~2147483647

[Signed] long [INT]

4

-2147483648~2147483647

unsigned long [int]

4

0~4294967295

Float

4

-3.4*10^38~3.4*10^38

Storage in floating-point form

Double

8

-1.798*10^308~1.798*10^308

Storage in floating-point form

Long double

8

-1.798*10^308~1.798*10^308

Short Int<=int<=long Int<=long Long int

Float<=double<=long Double

Basic data types for C languages

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.