+ 3
What is dynamic array?
3 Antworten
+ 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;
+ 2
Like In C++, if we need to insert more elements in an array then we use the function resize ();
+ 1
I have never heard of one. Dynamic means always changing I have heard of multidimensional arrays. What is your question in reference of?