Originally posted by Deepak Jain:
int[] a1[],a2[]; // 1
int []a3,a4[]; // 2
int []a5,a6[]; // 3
int[] a7,a8; // 4
Here a2, a4 and a6 all have thier own dimention becuase they are declared as a2[],a4[] and a6[]. Now since they are declared with comma operator and because [] is placed after the datatype , Hence [] gets applied to a2, a4 and a6 and therefore makes them a 2-dimentional array.
If you have
int a1[], a2[]; then here a2 is a single dimentional array.
Hope this clears.
But if you have
int[] a1, a2[] then a1 is 1-D and a2 is 2-D.
Thanks
Deepak
Hmm. This is where the confusion is. I can understand a2[] being a 2-D array. but not a4 and a6.
In the case of a2 we have:
int[] a1[],a2[]; // so with this i can see that a2 is a 2-d array
but with
int []a3,a4[]; // shouldn't this mean that a3 is a 1-d array and so is a4? as each array has its own []. a3 has it before and a4 has its after.
If I had declared the array as []a3,[]a4 //then a3,a4 would both be 1-d array yes?
but if I declare as []a3,a4[] then a4 becomes a 2-d aray???
[ November 30, 2007: Message edited by: Chunnard Singh II ]