dynamic array vs array given the size at run time

Mar 19, 2016 at 4:31am
Hello all ,
As many of you know that GCC compiler let you give a size of an array during a run time. However, that made some conflict with dynamically allocated array to which one to use. Are there any use cases other than stack and heap place of allocation between them. Meaning
Array given size at run time allocates the size in the stack.
Dynamic Array allocated the size in the heap.
Last edited on Mar 19, 2016 at 4:32am
Mar 19, 2016 at 5:08am
An array allocated on the stack cannot be returned to the caller and is limited in size by the size of the stack. An array allocated on the heap has neither of these restrictions.
Mar 19, 2016 at 5:09am
helios
Thank you so much that is helpful.
However, can i say that the stack is smaller in size than the heap section ?
Last edited on Mar 19, 2016 at 5:31am
Mar 19, 2016 at 12:35pm
Yes. Pretty much always. The heap is only limited by the amount of memory in the system.
Topic archived. No new replies allowed.