The third step in C Language Learning-Data Types in C Language

Source: Internet
Author: User

Data Type


The C language provides a wide range of data types, which can be divided into two categories:Basic TypeAndConstruct Data Types.

The primary feature of basic data types is that they cannot be further decomposed into other types. That is to say, the basic data type is self-explanatory.

The constructed data type is defined according to one or more defined data types. That is to say, the value of a construction type can be divided into several "members" or "elements ". Each "member" is a basic data type or a constructor type.

In C,Construction typeThere are the following types:

Array type

, Structure type

, Union type.

The basic types are as follows:

1. Integer

An integer is used to store integers. Its value can be a decimal, octal, or hexadecimal number. Integer Variables are defined by the keyword int.

In addition, the integer type can be used with short, long, signed, unsigned, and other modifiers to form a new type. For example, a signed int indicates a short integer, A longint indicates a long integer, A singnedint indicates a signed integer, and an unsignedint indicates an unsignedint.


2. Floating Point Type

Float Type is also known as solid type single precision type or real type. It is often used to represent decimal places or numeric values beyond the Integer Range.

Float variables are defined by the keyword float.


3. Double Precision

The double-precision type is often used for scientific calculation of large numbers or demanding accuracy.

Double variables are defined by the keyword double.

 

4. Balanced type

Delimiter is the data type used to represent ASCII characters.

Character variables are defined by the keyword char.


5. valueless

The valueless type is defined by the keyword void. The valueless type is a special type. It is often used in function definition to indicate that the function has no return value.

6. User-defined types

In addition to the data types provided by the system, the C language also allows you to customize data types. The definition format is as follows:

Typedef type name New TypeName;


 

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.