Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 586 Bytes

2darrays.md

File metadata and controls

20 lines (13 loc) · 586 Bytes

Two-Dimensional Arrays

Arrays that we have consider up to now are one-dimensional arrays, a single line of elements.

  • Often data come naturally in the form of a table, e.g., spreadsheet, which needs a two-dimensional array.

Two-dimensional (2D) arrays are indexed by two subscripts:

  • row
  • column

A two-dimensional array is the simplest form of a multidimensional array.

A two-dimensional array is, in essence, a list of one-dimensional arrays.

To declare a two-dimensional integer array of size [x, y] :

var arrayName [ x ][ y ] variable_type