+ 3

What is dynamic array?

2nd Feb 2018, 9:23 PM
Diwakar
Diwakar - avatar
3 ответов
+ 3
I got the answer, something like this... When amount of memory requirement is known at run time is known as dynamic allocation of memory.As unused memory is available on heap, so whenever memory requirement comes at run time it is allocated using heap data structure as it is pool of free memory space.In C++, we have operator known as new which return address allocated at heap to that variable.In C, dynamic allocation is done using function malloc() Example:- int* a = new int[50];   /* this request memory allocation for the array of type int and size 50;As soon as memory allocation is done we can release the space using operator delete operator. Example: delete[] a /*delete memory allocated to a sytax: int* a =  new int[50];     delete[] a;
3rd Feb 2018, 10:15 AM
Diwakar
Diwakar - avatar
+ 2
Like In C++, if we need to insert more elements in an array then we use the function resize ();
3rd Feb 2018, 10:18 AM
Diwakar
Diwakar - avatar
+ 1
I have never heard of one. Dynamic means always changing I have heard of multidimensional arrays. What is your question in reference of?
3rd Feb 2018, 3:00 AM
Tim Millar
Tim Millar - avatar