 | | From: | Nimmi Srivastav | | Subject: | ASCII art for multi-dimensional C arrays | | Date: | 19 Jan 2005 06:40:46 -0800 |
|
|
 | Graphical representation of a multidimensional C array e.g. int ia[2][3][6];
[6] => Outermost index [3] => Middle index [2] => Innermost index
--------- --------- --------- --------- --------- --------- | ia[0] | ia[1] | ia[2] | ia[3] | ia[4] | ia[5] | --------- --------- --------- --------- --------- --------- / \ Outermost index [size 6] / \ / \ ---------------- ---------------- ---------------- | ia[0][0] | ia[0][1] | ia[0][2] | ---------------- ---------------- ---------------- / \ Middle index [size 3] / \ / \ ---------------------- ---------------------- | ia[0][0][0] | ia[0][0][1] | ---------------------- ---------------------- Innermost index [size 2]
|
|
 | | From: | Nimmi Srivastav | | Subject: | Re: ASCII art for multi-dimensional C arrays | | Date: | 19 Jan 2005 07:00:06 -0800 |
|
|
 | The graphical representation of a multidimensional C array makes it clear why only the "innermost" index may be unsized if the array is initialized. In that case the value of the "unsized" index is the number of entries that are specified in the initializer list.
|
|
 | | From: | Nimmi Srivastav | | Subject: | Re: ASCII art for multi-dimensional C arrays | | Date: | 20 Jan 2005 21:51:46 -0800 |
|
|
 | Another try (hopefully the format in this case will not be screwed up!)
int ia[2][3][6];
[6] => Outermost index [3] => Middle index [2] => Innermost index
* --------- --------- --------- --------- --------- --------- * | ia[0] | ia[1] | ia[2] | ia[3] | ia[4] | ia[5] | * --------- --------- --------- --------- --------- --------- * / \ Outermost index [size 6] * / \ * / \ * ---------------- ---------------- ---------------- * | ia[0][0] | ia[0][1] | ia[0][2] | * ---------------- ---------------- ---------------- * / \ Middle index [size 3] * / \ * / \ * ---------------------- ---------------------- * | ia[0][0][0] | ia[0][0][1] | * ---------------------- ---------------------- * Innermost index [size 2] *
|
|