How can we Justify this thing that Dynamic memory allocation is more flexible and efficient than static memory allocation but slower than static?Pls explain

Do some research on google, then come back with yuor findings and we will spread some more light on it, but it sounds to me like a homework question and you are looking for a copy and paste answer!

Chris

Hello Chris
Here is my Reply
Dynamic memory allocation is more efficient and flexible than static memory allocation because in static memory allocation, memory is assigned to a program at the compile time without actually knowing the exact memory required by the program during the run time. This allocated memory is never freed until the program's execution is finished. On the other in dynamic memory allocation memory is allocated to the program at the run time as per
requirement, the allocated memory can be freed as it not required by the program and can be used by other programs.
In programming perspective, the only way to get dynamically allocated memory is via system call and the only way to refer to this dynamically allocated space is through a pointer.
This is how the actual process of dynamic memory allocation requires more Computational time and hence it is slower than static memory allocation.

Can you pls let me know what should i write for the justification i mean any example or some more.Share you views

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.