C如何在多维数组中分配数据项?

Ros*_*ane 2 c arrays multidimensional-array

我想知道C将如何分配多维数组的数据项,以及它们的分配是否跨机器一致.

我知道,在最低级别,数据项是邻居,但我不知道它们是如何进一步安排的.

例如,如果我将3D数组分配为int threeD[10][5][6],我可以假设&(threeD[4][2][5]) + 1 == &(threeD[4][3][0])吗?在所有机器上?

在此先感谢您的帮助.

pmg*_*pmg 5

是的,数组在C编译器的所有实现中按行主顺序存储.
标准说(我应用了一些重新格式化):

6.5.2.1 Array subscripting
    Constraints

3   Successive subscript operators designate an element of a multidimensional
    array object.  
    If E is an n-dimensional array (n >= 2) with dimensions i * j * . . . * k,
    then E (used a s other than an lvalue) is converted to a pointer to an
    (n - 1)-dimensional array with dimensions j * . . . * k.
    If the unary * operator is applied to this pointer explicitly, or
    implicitly as a result of subscripting, the result is the pointed-to
    (n - 1)-dimensional array, which itself is converted into a pointer if
    used as other than an lvalue. It follows from this that arrays are stored
    in row-major order (last subscript varies fastest).