Joe7 showed how to handle a 1 dimensional array. Sqiddster showed how to handle a 2 dimensional array. Here is an example that also handles a three dimensional array.
Actually, it has 3 arrays: one dimension, two dimension, and three dimension. It loops through all dimensions of the arrays inserting a number into each "cell" and then when the mouse is clicked, retrieves a value from a random "cell" in each array.