Data Structure Week1 Arrays

Definition of Array:

Contiguous area of memory consisting of equal-size elements indexed by contiguous integers.

What's Special About Arrays?

Constant-time access
array_addr + elem_size * (i - first_index)

How to get the address of multi-dimensional arrays?

image.png

Row-major,row keep unchanged,and column add.In column-major ordering, the first index changes most rapidly.

image.png

你可能感兴趣的:(Data Structure Week1 Arrays)