Traditional Culture Encyclopedia - Traditional festivals - Definition of Structured Array in C
Definition of Structured Array in C
The so-called structure array is an array in which each element is a structure. In practice, C language structure array is often used to represent a group of people who have the same data structure, such as students in a class, workers in a workshop and so on.
Structures can store different data types, linking them to each other. An array of structures can store multiple structures consecutively and acts similarly to an array. For example, you want to define the four coordinate values of the same minimum outer rectangle and give this rectangle a feature number. When you need to store information about more than one minimum outer rectangle, you need to dynamically request a struct array.
struct struct type name {type name member name; type name member name; ......}, declare the structure type first, then define the structure variable name. Declaring a structure type does not allocate space, defining a variable of a structure type allocates memory space.
Extensions:
Structure array pointer type:
A pointer to a structure variable is the starting address of the memory segment occupied by the variable. A pointer variable can be set up to point to a structural variable, where the value of the pointer variable is the starting address of the structural variable, and a pointer variable can also be used to point to elements in a structural array.
1. Type 1:
A pointer to a structure variable references a member of the structure variable.
2. Type 2:
A structural variable and a pointer to the structural variable form a chained table, which is a common and important data structure. A linked table has a "head pointer" variable, denoted by head, which holds an address. This address points to an element.
Each element in a chain table is called a "node", and each node should contain two parts:
the actual data that the user needs to use,
and the address of the next node.
The storage units in memory for each element in a chained table can be discontinuous. To find a particular element, you can first find the previous element and find the next element based on the address of the next element it provides. This data structure of a chained table must be realized by using structure variables and pointers.
A structure type can be declared that contains two types of members, the actual data that the user needs to use, and a pointer variable that is used to hold the address of the next node.
Baidu Encyclopedia - Structure Types - Arrays
- Previous article:What are the teaching methods of mathematics in primary schools?
- Next article:The way to grab the board in straight table tennis?
- Related articles
- What is the energy consumption of 1.4MW hot water boiler per hour? The outlet water temperature is 85 degrees, and the return water is 30 degrees.
- Does anyone know the medicinal properties and functions of Firefox?
- The new era of civilization practice propaganda slogans banner slogans Daquan
- Godfather cocktail recipe
- When does Vietnam celebrate the New Year?
- The traditional way of taking care of painting?
- How to tightly wrap jiaozi into jiaozi? Why not wrap them tightly?
- What are the characteristics and forms of Chinese flower arrangement?
- The Faith of Taoists
- The basic skills of China, Hou Shi and Tai Ji Chuan.