Allocate and initialize the array.