How to access the deleted element of an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to access the deleted element of an array?

for example if we have an array [Ahmad,Alex,John] if I delete the first element so how I can again access to first element?

8th Sep 2020, 6:24 PM
Noria Soltani
Noria Soltani - avatar
2 Answers
+ 3
One thing to note in your mind if you creat array like your example than you are not able to delete those elements from array yes you have another way to replace array value 0 or somthing but once you creat static array then you are not able to delete those array elememts.
8th Sep 2020, 8:35 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 3
You cannot delete an element by from an array, you can only overwrite it with a different value or null, if it is not an array of primitives. But because arrays are not resizable, you will always have an access to the first value calling arrayName[0] even if it's null.
8th Sep 2020, 8:36 PM
Aleksandrs
Aleksandrs - avatar