One: dynamic memory management
Two: flexible array:
1. Statement:
struct A
{
int i;
int arr[];//不指定数组大小
};
2. Flexible array features:
(1) A flexible array member in a structure must be preceded by at least one other member.
(2) The size of the structure returned by sizeof does not include the memory of the flexible array.
(3) The structure containing flexible array members uses the malloc() function to dynamically allocate memory, and the allocated memory should be larger than the size of the structure to accommodate the expected size of the flexible array.
3. Advantages of flexible arrays:
(1) It is convenient for memory release
(2) This is beneficial to the access speed