Dynamic array creation

why we create a dynamic array

dynamic array is created at the runtime
int *arr=new int[n];
this is the way to create dynamic array

if we make static array like
int arr[100];
but if n is 10 only then 90 integer bytes of memory is wasted

but in case of dynamic array only 10 blocks of integers are created

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.