Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Definition of structural array in C language
Definition of structural array in C language
The so-called structure array means that every element in the exponential group is a structure. In practical application, C language structure array is often used to represent a group with the same data structure, such as a class student and a workshop worker.

Structures can store different data types and associate them with each other. Structure arrays can store multiple structures in succession, similar to arrays. For example, you want to define four coordinate values of the same minimum bounding rectangle and give this rectangle a feature number. When it is necessary to store the information of multiple minimum bounding rectangles, it is necessary to dynamically apply for a structural array.

Structure type name {type name member name; Type the name member name; .....}, first declare the structure type, and then define the structure variable name. Declare structural types, do not allocate space, define structural type variables, and allocate memory space.

Extended data:

Structure array pointer type:

The pointer to the structure variable is the starting address of the memory segment occupied by the variable. You can set a pointer variable to point to a structure variable. At this time, the value of the pointer variable is the starting address of the structure variable, and the pointer variable can also be used to point to the elements in the structure array.

1, type 1:

A pointer to a structure variable points to a member in the structure variable.

2. Type 2:

Linked list consists of structural variables and pointers to structural variables, which is a common and important data structure. The linked list has a "head pointer" variable, represented by head, which stores an address. The address points to an element.

Each element in the linked list is called a "node", and each node should include two parts:

One is the actual data that users need,

The second is the address of the next node.

The storage unit of each element in the linked list in memory can be discontinuous. To find an element, you can first find the previous element and find the next element according to the address of the next element it provides. The data structure of this linked list must be realized by structural variables and pointers.

You can declare a structure type, which contains two kinds of members, one is the actual data needed by the user, and the other is the pointer variable used to store the address of the next node.

Baidu Encyclopedia-Structure Type-Array