For each dimension of your array, you will need another for loop. For instance, if I have a 2-D array:int myMatrix[ROWS][COLS]; Then I would fill it by saying something like:
| |||
Well I guess the next dimension would be a 3d array. So:int 3darray[5][5][5]; This would give you an array that is 5 ints tall, 5ints wide, 5 ints thick. To add a values to all the parts you would need:
Displaying would be more complicated - depending on the way you want to display, I could think of a way but it wouldn't be very good. I don't know about more then 3d arrays though. | |||
And here's four-d arrays, for good measure.
for five-d and beyond, You should be able to look at what we've given you and see the pattern emerging. Just add some more square brackets and for loops. | |||
No comments:
Post a Comment