What is static memory allocation in c programming?
Answers
Answered by
0
This is used when the amount(size) ofmemory is variable and is known only during run-time. Dynamic allocation is achieved using certain functions likemalloc(), calloc(), realloc(), free in Cand "new", "delete" in C++. Static Memory Allocation - memory allocated at compile time in stack or other data segments.
hope it helps
hope it helps
Answered by
0
Answer:
Its not that static memory allocation is not used but its has many disadvantages or we can call them limitations :
The scope and lifetime is limited
Only when globally defined its scope is not bounded
The amount of memory available through stack-based allocation is commonly far less than the amount of memory available through heap-based memory allocation.
Once you move out of the system,the memory crashes that is a very big disadvantage.
Merits :
It has automatic cleanup and no manual assistance is required for this process.It is best used when the size is already know to you.
Similar questions