For future readers of this question, Eric Postpischil's answer is correct and I have accepted it because it is. Here is a sample program and output to demonstrate the sizeof operator/function as it applies to multidimensional arrays.
In general, if declared as an array of ints
int mda[x][y][z];
then mda[a][b][c] == *(mda + ((a *( y* z)) + (b*z) + (c))
Whats important, atleast to the original question i asked, is that indexing into array with fewer "dimensions" than it was declared with your program still will compile and maintain the "sizeof" the next array.
mda[a] == *(mda + (a * (y*z))) AND sizeof(mda[a]) == sizeof(array_type) * y * z
mda[a][b] == *(mda + (a * (y*z)) + (b * z)) AND sizeof(mda[a][b]) == sizeof(array_type) * z
Ok so heres a sample program that you can run in an online IDE and verify:
#include <stdio.h>
#define X (4)
#define Y (10)
#define Z (5)
int multi_dimension_array[X][Y][Z];
void print_array(){
for(int i=0; i<X; i++){
printf("THIS IS THE %dth value of X\n", i);
for(int j=0; j<Y; j++){
for(int k=0; k<Z; k++){
printf("%d ", multi_dimension_array[i][j][k]);
}
printf("\n");
}
}
}
int main(void) {
printf("%d %d %d %d\n", sizeof(multi_dimension_array[0][0][0]), sizeof(multi_dimension_array[0][0]), sizeof(multi_dimension_array[0]), sizeof(multi_dimension_array));
memset(multi_dimension_array,0x01,sizeof(multi_dimension_array));
print_array();
memset(&multi_dimension_array[2],0x0,sizeof(multi_dimension_array[2]));
printf("\n\n\nNEXT MEMSET with the X=2 zeroed out\n\n\n");
print_array();
return 0;
}
And Here is this programs output:
4 20 200 800
THIS IS THE 0th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
THIS IS THE 1th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
THIS IS THE 2th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
THIS IS THE 3th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
NEXT MEMSET with the X=2 zeroed out
THIS IS THE 0th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
THIS IS THE 1th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
THIS IS THE 2th value of X
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
THIS IS THE 3th value of X
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
16843009 16843009 16843009 16843009 16843009
*Note that memset sets each byte to the value of the second paramater, which in this case was 0x01 which makes the 4 byte ints 0x01010101 == 16843009.