
Array Address Calculation
Address formulas for one-, two- and three-dimensional arrays in row-major and column-major order with arbitrary lower bounds, the general n-dimensional rule, element counts, reverse problems that recover the base address or a dimension from two known addresses, and a compiled C program showing that C stores arrays row by row. All worked values are computed by a verification script.
![Two 3 by 4 grids give the memory offset k of a[i][j]: row-major numbers the cells 0 to 11 along each row, column-major down each column. Cell a[1][2] is offset 6 in row-major and 7 in column-major.](https://bywjbbkinjqiyalvzqfd.supabase.co/storage/v1/object/public/sheet-media/DS/DS-02/diagrams/DS-02.d01.webp)
