Why can we omit the first dimension of a multidimensional array when we are passing it to a function

后端 未结 2 851
-上瘾入骨i
-上瘾入骨i 2020-12-31 17:55

Why can we omit the first dimension of a multidimensional array when we are passing it to a function?

In my programming class, we were told what when passing a multi

2条回答
  •  时光取名叫无心
    2020-12-31 18:35

    Because the array will decay to pointer and to calculate offset to the elements of the array you do not need to know the innermost dimension. Offset to a[i][j][k] is i*nj*nk+j*nk+k (where nj and nk are corresponding dimensions).

提交回复
热议问题