Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Row-major order » ?

Definition 4.5 University Computer Science — Year 1 · Chapitre 4 — Pointers and Arrays

A two-dimensional array int g[h][w] is an array of hh rows, each an array of ww elements, stored one row after the other: this is row-major order. Element g[i][j] is element i⋅w+ji \cdot w + j of the block of h⋅wh \cdot w elements.

The array g[3][4] of , as written in the source and as stored. The shade marks the row. Walking a row is a stride of 1 in memory; walking a column, a stride of 4.
The array g[3][4] of Listing 4.7, as written in the source and as stored. The shade marks the row. Walking a row is a stride of 1 in memory; walking a column, a stride of 4.
Lire dans le chapitre →