Answer:
The C programming language manages memory statically, automatically, or dynamically.
Static-duration variables are allocated in main memory, usually along with the executable code of the program, and persist for the lifetime of the program
Automatic-duration variables are allocated on the stack and come and go as functions are called and return.
For static-duration and automatic-duration variables, the size of the allocation is required to be compile-time constant.
Dynamic memory allocation in which memory is more explicitly (but more flexibly) managed, typically, by allocating it from the heap, an area of memory structured for this purpose.
In C, the library function malloc is used to allocate a block of memory on the heap. The program accesses this block of memory via a pointer that malloc returns. When the memory is no longer needed, the pointer is passed to free which deallocates the memory so that it can be used for other purposes.
Static-duration variables are allocated in main memory, usually along with the executable code of the program, and persist for the lifetime of the program
Automatic-duration variables are allocated on the stack and come and go as functions are called and return.
For static-duration and automatic-duration variables, the size of the allocation is required to be compile-time constant.
Dynamic memory allocation in which memory is more explicitly (but more flexibly) managed, typically, by allocating it from the heap, an area of memory structured for this purpose.
In C, the library function malloc is used to allocate a block of memory on the heap. The program accesses this block of memory via a pointer that malloc returns. When the memory is no longer needed, the pointer is passed to free which deallocates the memory so that it can be used for other purposes.