multi-dimensional arrays

Multi-dimensional arrays (MDA's) are one of the mot difficult structures for new programmers to visualize (after pointers of course; I'll let you know when I figure those out). I have read a few interpretations of ways to visualize them. These easily explain small MDA's of 2 or 3 dimensions but fall short for larger MDA's (example).

When I stumbled upon the following solution I was amazed at how clear MDA's became. Instead of seeing an MDA as a set of dimensions, visualize them as a file tree where elements on the same level are in the same dimension or like an outline where those with the same style numbering are in the same dimension. Look at the four dimensional array below (remember array indicies start at zero):

		array [2] [2] [1] [1];
		
		I. first dimension, element 0	
			A. second dimension, element 0
				1. third dimension, element 0
					a. fourth dimension, element 0
			B. second dimension, element 1
				1. third dimension, element 0
					a. fourth dimension, element 0
						
		II. first dimension, element 1
			A. second dimension, element 0
				1. third dimension, element 0
					a. fourth dimension, element 0 
			B. second dimension, element 1
				1. third dimension, element 0
					a. fourth dimension, element 0 
		

NOTE: Something I just found out in a practical application is that you must be careful with large MDA's, they increase your memory usage exponentionally. I was using 20+ three and four dimensional arrays and every time I tried to open or debug the program it would crash. It turned out that I did not have enough memory to load the entire program into memory. The nature of the program was such that it would set aside memory for its entire size upon loading. Be aware how memory allocation works in your application and keep track of what you are expecting from the computer.

I hope this helps those of you that are struggling.