1. malloc and free in C language are standard library functions in C language, used to apply for dynamic memory and release memory. -Manage dynamic memory
2. For non-Internal data objects, the use of maloc/free alone cannot meet the requirements of dynamic objects. The constructor must be automatically executed when the object is created, and the Destructor must be automatically executed before the object is extinct. Because malloc/free is a library function rather than an operator and is not controlled by the compiler, it is impossible to impose the tasks of executing constructor and destructor on malloc/free.
3. Notes for using malloc and free:
Malloc requires support for the header file library function.
Malloc allocates a piece of memory.
Malloc is allocated with a memory area, which can be accessed with pointers and moved inside.
That is
Malloc is a function that can overwrite
Malloc only allocates memory, free only recycles memory
More directly, you can use malloc to dynamically apply for memory blocks in c.
So static application memory block?
It can be implemented when a variable is declared or the output is
Char a (10)
Declare a variable array a (10) and apply for 10 Static Memory Spaces
{Basic knowledge:
One Variable occupies 1 memory block
An integer constant occupies 2 memory blocks.
A floating point constant occupies 4 memory blocks}
Author "LinuxLeon"