Basic data types for C languages

Source: Internet
Author: User
Tags sin

The various variables used in the program should be defined beforehand, defined first, and then used. The definition of a variable can include three aspects: data type, storage type, scope.

The data type is divided by the nature of the defined variable, the representation, the amount of storage space, and the structural characteristics. in C language, data types can be divided into: basic data type, construction data type, pointer type, empty type four categories.

Data type Description:

Data Type Description
Basic data types The main feature of the basic data type is that its value can no longer be decomposed into other types. In other words, the basic data type is self-explanatory.
Constructing data types A constructed data type is defined by a constructed method based on one or more defined data types. That is, a value of a constructed type can be decomposed into several "members" or "elements". Each "member" is either a basic data type or another constructed type. in the C language, there are several types of constructs: array type, struct type, common body (Union) type.
Pointer type Pointers are a special, but also important, type of data. Its value is used to represent the address in the memory of a variable. Although the value of a pointer variable is similar to an integer, this is a completely different amount of two types and cannot be confused.
Empty type When calling a function value, a function value should normally be returned to the caller. The returned function value is of a certain data type, and should be given in the function definition and function description, for example, in the definition of the MAX function in an example, the function head is: int max (int a,int b), where the "int" type specifier means that the return value of the function is an integral type. As in the example, the library function sin is used, because the system specifies that its function return value is a double-precision floating-point type, so in the assignment statement S=sin (x), s must also be a double-precision floating-point type in order to match the return value of the SIN function. So in the Description section, describe S as a double-precision floating-point type. However, there are also a class of functions that, when called, do not need to return a function value to the caller, which can be defined as "null type". Its type specifier is void. The following functions are also described in detail.

Basic data types for C languages

Related Article

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.