Question on Arrays in Ethereum

in #help8 years ago (edited)

Greetings Fellow Crypto-Enthusiasts!

I am working on a project in Ethereum to create a token contract (and I'll be announcing it formally with more details on Steemit, when the time comes!). I'm saving data to an array, for later use, and after I use a piece of data I would like to delete it.

if I have an array such as uint[] a = [10,20,30,40];

Will delete(a[2]); simply set the value of a[2] to zero, or will it actually move each subsequent value up one notch?

I think it might be a good alternative to occasionally allocate a memory array, read all still-good values into the array, and after calling delete(a); (which I know will reset the length) save the memory array back to the original storage array. But I'm not sure if that's the best use of gas or not.

Anyone else have any thoughts?