initialize array using the index