I am looking for the dimensions of a 2d array. Not the fixed values assigned to the array, but the values containing integers. Example:
int a[][] = new int[4][5];
a[1][1] = 1;
a[1][2] = 2;
a[1][3] = -2;
a[1][4] = 0;
a[2][1] = -3;
a[2][2] = 4;
a[2][3] = 7;
a[2][4] = 2;
a[3][1] = 6;
a[3][2] = 0;
a[3][3] = 3;
a[3][4] = 1;
Only 3 variables are used out of 4, and 4 variables used out of 5. How can you tell what is actually there versus what is assigned to be there?
array.length;
array[0].length;
The previous code will only give you the fixed variable assigned to the array. But what if your not using all the variables? In other words I am looking for an output of 3 for columns and 4 for rows.