Sunday, 21 June 2015

Multi-dimensional Arrays in Programming

Two Dimensional Arrays

int A[4][2]
A[rows][columns]

Storage in memory: row major order. Memory storage is always one dimensional storage.

Two Dimensional arrays are always rows followed by columns

It is just like there are 10 classes, each class have 10 students and 1 monitor and every all monitors are ordered by one teacher.

Teacher[10][10].

Teacher

  • Monitor1
    • Student 1
    • Student 2
    • Student 3
    • [upto 10]
  • Monitor2
    • Student 1
    • Student 2
    • Student 3
    • [upto 10]
  • Monitor3
    • Student 1
    • Student 2
    • Student 3
    • [upto 10]
  • and so on
Similarly with 3 Dimensions 

It will go at 3 levels. 

No comments:

Post a Comment