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