Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Row-major order?

Definition 4.5 University Computer Science — Year 1 · Capítulo 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.
Ler no capítulo →