in reply to Array element getting deleted

You copied that question from Why does calling this function change my array? on stackoverflow