when is memory allocated for an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

when is memory allocated for an array?

27th May 2017, 9:31 PM
David
David - avatar
3 Answers
+ 2
Upon creation (via 'new') the data is stored on the heap during run time.
27th May 2017, 11:29 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
compile time. and not runtime as some others have answered. Memory is allocated during runtime only when we manually allocate memory as and when required.
28th May 2017, 6:15 AM
Mohammad Fahad Sayed
Mohammad Fahad Sayed - avatar
- 1
When you create it and the size is therefore known.
27th May 2017, 10:46 PM
1of3
1of3 - avatar