Do I save a memory when I'm declaring an array, instead of storing a list of values, or I will just save the time? [answered] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Do I save a memory when I'm declaring an array, instead of storing a list of values, or I will just save the time? [answered]

2nd Mar 2017, 7:48 PM
AdaMM
AdaMM - avatar
2 Answers
+ 11
No, an array needs more memory than storing primitive datatypes. But it's worth it, if it can improve readability of the code and of course it's easier to access the elements or to loop through it.
2nd Mar 2017, 8:07 PM
Tashi N
Tashi N - avatar
+ 4
Thanks for your answers
2nd Mar 2017, 9:20 PM
AdaMM
AdaMM - avatar