lifetime of allocated memory
|
Static-duration variables are allocated in main memory, along with the executable code of the program, and persist for the lifetime of the program whether it is needed or not.
|
In Dynamic Memory Allocation allocated from the large pool of memory, which is called heap. 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 de allocates the memory so that it can be used for other purposes
|
No comments:
Post a Comment