I have this array of struct
struct Prodotto {
string titolo;
address owner_address;
}
Prodotto[] public prodotti;
And I create two products like this:
titolo: titolo stravolto
owner: 0x144c9617C69B52547f7c2c526352E137488FAF0c
titolo: titolo secondo prodotto
owner: 0xa53709839ab6Da3ad9c1518Ed39a4a0fFCbA3684
I want to delete the element with index 0
in my contract I have this function
function deleteProdotto(uint _id_prodotto) external payable onlyOwnerOf(_id_prodotto) {
delete prodotti[0];
}
If I retrive element to index 0, I have a product like this
titolo:
owner: 0x0000000000000000000000000000000000000000
How can I delete that index? I know that after that I have to do
prodotti.length--
But before I have to resolve this issue