Static and dynamic memory allocation

How do we know that we have to allocate static memory or dynamic memory?

Hey @tanyaa.sood
Dynamic allocation is required when you don’t know the worst case requirements for memory. Then, it is impossible to statically allocate the necessary memory, because you don’t know how much you will need.

Even if you know the worst case requirements, it may still be desirable to use dynamic memory allocation. It allows for the system memory to be used more efficient.
So in this case, it’s your choice which kind of memory you want to allocate.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.