Why are we using DMA?

why are we using Dynamic Memory Allocation in the above question?

@Ak07 by static memory allocation, we usually end up allocating more space than is actually needed, hence dynamic memory allocation ensures that there is no wastage of space. It allocates the exact amount of space as per the user input.

@Ak07 as per c++ standards, array size must be a constant expression. This type of syntax might give an error in some compilers. If you dont want the hassle of DMA, go for vectors. They also use DMA but behind the scenes. And vectors a whole range of other functions as well.

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.