can you add or insert values into an array, or does it have to be a stack? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

can you add or insert values into an array, or does it have to be a stack?

11th Apr 2017, 10:23 PM
Jay
3 Respuestas
+ 20
adding new items to array can be done through creating new array of needed length, copying old one there + new items; or just make another array and merge it with first one but that creates 3rd array... (look in my dices code)That's in case u want use only arrays
11th Apr 2017, 11:20 PM
Illusive Man
Illusive Man - avatar
+ 3
an array's size is always a fixed length. so you cannot change the length. only change the values of the items. you can use a stack if you want, but a list would probably be better
11th Apr 2017, 10:25 PM
Edward
+ 1
can you sum the int in a list?
11th Apr 2017, 10:40 PM
Jay