Professional Documents
Culture Documents
In this tutorial, we are going to learn about how to store elements in a two-dimensional array. For those who
love to learn through videos, jump over to the bottom of the page, there’s a video tutorial for you.
Before starting storing elements of a multi-dimensional array, let’s say I’ve an one dimensional array having
elements like this:
A1 A2 A3 A4 ... An
One thing you need to remember is, no matter what type of array it is (1D or multi-dimensional), they will be
always stored linearly in the memory space as above.
Let’s jump to the case of multi-dimensional arrays now. Imagine I’ve a 3×3 matrix like this:
The real problem of storing elements arises here, since elements have to be stored linearly in the memory space,
we have many possible ways to store them. Here are some of the possibilities I could’ve had for the matrix
above.
1. A11 A13 A12 A21 A23 A22 A31 A33 A32 A33
2. A11 A22 A33 A12 A32 A13 A23 A31 A32 A21
… and I could go on filling randomly depending on the no. of elements I’ve in my 2-D array.
Out of all these possible ways, there are two main ways of storing them, they are:
In this method, the elements of an array are filled up row-by-row such that the first row elements are stored first,
then the second row and so on.
Most of the high level programming languages like C/C++, Java, Pascal, etc use this method for storing
multidimensional arrays.
http://www.cbseguy.com/row-column-major-address-calculations-cbse/ 1/3
1/29/2018 Row major and Column Major address calculations - CBSE
As you can see in the 3×3 Matrix array we have above, I want to know at what position is my element A12
located in the linear memory space. This position is called the OFFSET.
One way to do it is to make up a linear diagram like the one below, count manually using 0 as the starting index
and go on till the element I need. But imagine you are given an array like A[20][40], definitely you can’t go over all
these elements if you wanted to know, say where A[15][20] is located.
For this, we resort to a fairly easy mathematical method of calculating the offset.
Here is the formula to calculate the offset for row major ordering
In Column Major ordering, all the elements of the first column are stored first, then the next column elements and
so on till we are left with no columns in our 2-D array.
Depending on the ordering method the elements are stored in the memory, we will get different positions of an
element in the linear memory and consequently a different address for each method. To calculate the address we
use the following procedure:
Step 1: Get the offset value of the element under consideration, make sure you use the correct forumula.
Step 2: Multiply the offset with the size of the element’s datatype (Like int is of 4 bytes for 32-bit, Earlier
http://www.cbseguy.com/row-column-major-address-calculations-cbse/ 2/3
1/29/2018 Row major and Column Major address calculations - CBSE
compilers like TurboC worked on 16-bit platform and for them size of int is 2 bytes).
Step 3: Add this to the base address to get the final address
http://www.cbseguy.com/row-column-major-address-calculations-cbse/ 3/3
1/29/2018 PARWEZ'S BLOG: ADDRESS CALCULATION FOR TWO DIMENSIONAL ARRAY
W denotes the size, i.e; number of bytes per data element of the array A,
M is total numbers of rows, and N is total number of columns in the array.
In case of C language
LBR (Lower bound row) = 0
LBC (Lower bound column) = 0
e.g. Suppose element of array A[4][5] occupies 4 bytes, and the address of the 1st element is 49.
Find the address of the element A(4,3) when the storage is row major.
= BA + [n * (i - LBR) + (j - LBC)] * w
= 49 + [5 * (4 – 0) + (3 - 0)] * 4
= 49 + [23] * 4
= 49 + 92
= 141
http://pakhtar09.blogspot.in/2012/09/address-calculation-for-two-dimensional_29.html 1/1
1/29/2018 programming centre: how to calculate the address of the 2D array
WHAT IS A 2D ARRAY?
A matrix (two dimensional array) is a group of lists, or arrays that are organized into one data set. To understand them,
first look an example of the standard one dimensional array:
Array "A":
16
8
99
0
5
You can reference any point in the "array" by naming the array and following it with a number representing the position
of a piece of data on the list. The first data on the array is represented with a "0", the second with a "1", and so on. For
example, A[2] (in bold) represents 99 because it is the third figure of array A. You could imagine the references of the
above table as the following:
Array "A":
[0]
[1]
[2]
[3]
[4]
Matrix "B":
16 17 9
8 88 74
99 12 21
0 6 40
5 19 18
There are 3 different arrays in a single data set, "B". In Array A, you could reference any data by naming the point on
the list, such as "1" or "3". However, with a matrix, you must give both a row and a column. You can reference data on
a matrix in the following format:
MatrixName[row][column]
http://programmingcentre.blogspot.in/2012/11/how-to-calculate-address-of-2d-array.html 1/2
1/29/2018 programming centre: how to calculate the address of the 2D array
For example, B[3][2] would represent 40 because it is the it is on the fourth row down and the third column. Remember,
matrix references also start at zero, not one! You can reference any of the data on this table with this chart:
Matrix "B":
[0][0] [0][1] [0][2]
[1][0] [1][1] [1][2]
[2][0] [2][1] [2][2]
[3][0] [3][1] [3][2]
[4][0] [4][1] [4][2]
Two-dimensional arrays are used everywhere, but are especially prevalent in computer programming and accounting
http://programmingcentre.blogspot.in/2012/11/how-to-calculate-address-of-2d-array.html 2/2
1/29/2018 Application of Arrays
Arrays are used to implement mathematical vectors and matrices, as well as other kinds of
rectangular tables. Many databases, small and large, consist of (or include) one-dimensional
arrays whose elements are records.
1) Heaps :
We can implement heap as a trees or arrays.
2) Hash tables :
This is used to store information so the information in the hash table basically has two main
components- key and value.
3) Deques :
It is the short form of Double Ended Queue. In this we can add to either sides and remove from
the either sides.
4) Queues :
It is called FIFO(First In First Out) Data Structure. In this the first element added is the first
element that would come out.
5) Stacks :
It is based on LIFO(Last In First Out) Data Structure. In this the very last thing that is added to it
is the first thing which come out.
6) Strings :
String in C is an Array of characters.
7) Lists :
Arrays can be used with different types of lists we will study further in detail.
One or more large arrays are sometimes used to emulate in-program dynamic memory allocation,
particularly memory pool allocation. Historically, this has sometimes been the only way to allocate
"dynamic memory" portably.
Arrays can be used to determine partial or complete control flow in programs, with the help of
different control flow statements as a compact alternative to (otherwise repetitive) multiple IF
statements. They are known in this context as control tables and are used in conjunction with a
purpose built interpreter whose control flow is altered according to values contained in the array.
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Application-of-Arrays 1/1
1/29/2018 Character Strings and its Operations in C
Basically Strings in C is called the array of characters or sequence of characters. They are
terminated by a special character '\0' . For example :- Amit - my name is a String. Here, String is
a collection of the characters of my name like- A, M, I, T. So it is stored like characters in memory
like:
'A' , 'M' , 'I' , 'T' , '\0'.
So now we have the question how we would store the character string to the memory? To
represent multiple but same type of character type string we use arrays. Now to store this we
define an array of character datatype like -
char arrayname [ 10 ] ;
Here, arrayname is the name of an array and 10 is the size of the array.
So, now we have the array of 10 memory blocks and we could store our name in these blocks. The
leftover empty blocks will be null.
A M I T
1) Concatenating Strings :-
Concatenation refers to the combining of two strings. Following example demonstrates the use of
concatenation operation :
#include < stdio.h >
#include < string.h > // This contains all the string manipulating functions
void main ( )
{
char string1[] = "Hello ! ";
char string2[] = "This is a program to show the concatenation operation of the string.\n";
strcat(string1 , string2); // Concatenate string1 and string2 in string1
printf("%s", string1);
getchar();
}
2) Copying Strings :-
Copying refers to the copying two strings. Following example demonstrates the use of copying
operation :
#include < stdio.h >
#include < string.h >
void main ( )
{
char string1[] = "This is a program to show the comparing operation of the string.\n";
char string2[] = "";
strcpy(string2,string1);
printf("%s", string2);
getchar();
}
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Character-Strings-and-its-Operations-in-C 1/2
1/29/2018 Character Strings and its Operations in C
4) Comparing String :-
Comparing refers to the comparing two strings if they are equal or not. Following example
demonstrates the use of comparing operation :
Here, in this program we will get the output 0 , since both the string are same and of same size.
#include < stdio.h >
#include < string.h >
void main ( )
{
char string1[] = "This is a program to show the comparing operation of the string.\n";
char string2[] = "This is a program to show the comparing operation of the string.\n";
int compare = strcmp(string1,string2);
printf("%d", compare);
getchar();
}
Here, in this program we will get the output -1 , since both the strings are not same and of
different size.
#include < stdio.h >
#include < string.h >
void main ( )
{
char string1[] = "This is a program to show the comparing operation of the string.\n";
char string2[] = "This is a program.\n";
int compare = strcmp(string1,string2);
printf("%d", compare);
getchar();
}
Here, in this program we will get the output 1 , since both the strings are not same but of same
size.
#include < stdio.h >
#include < string.h >
void main ( )
{
char string1[] = "This is a program to show the comparing operation of the string.\n";
char string2[] = "THIS IS A PROGRAM TO SHOW THE COMPARING OPERATION OF THE
STRING.\n";
int compare = strcmp(string1,string2);
printf("%d", compare);
getchar();
}
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Character-Strings-and-its-Operations-in-C 2/2
1/29/2018 Describe the formula of finding the location (address) of particular element in 2D array using example.
Answer:
Here
LOC (A [J, K]) : is the location of the element in the Jth row and Kth column.
E.g.
10 (1,1) 1000
20 (2,1) 1002
50 (3,1) 1004
60 (1,2) 1006
90 (2,2) 1008
Suppose we have to find the location of A [3, 2]. The
required values are:
40 (3,2) 1010
Base (A) : 1000
65 = 1000 + 2 [3 (1) + 2]
(3,4) 1022 = 1000 + 2 [3 + 2]
79
= 1000 + 2 [5]
= 1000 + 10
= 1010
Here
LOC (A [J, K]) : is the location of the element in the Jth row and Kth column.
E.g.
10 (1,1) 1000
60 (1,2) 1002
30 (1,3) 1004
55 (1,4) 1006
20 (2,1) 1008
Suppose we have to find the location of A [3, 2]. The
required values are:
90 (2,2) 1010
Base (A) : 1000
= 1000 + 2 [8 + 1]
79 (3,4) 1022
= 1000 + 2 [9]
= 1000 + 18
= 1018
http://www.xpode.com/ShowArticle.aspx?ArticleId=500 3/3
1/29/2018 Memory Address Calculation in an Array – Guide For School
Array of an element of an array say “A[ I ]” is calculated using the following formula:
Address of A [ I ] = B + W * ( I – LB )
Where,
B = Base address
W = Storage Size of one element stored in the array (in byte)
I = Subscript of element whose address is to be found
LB = Lower limit / Lower Bound of subscript, if not specified assume 0 (zero)
Example:
Given the base address of an array B[1300…..1900] as 1020 and size of each element is 2 bytes in the memory.
Find the address of B[1700].
Solution:
Address of A [ I ] = B + W * ( I – LB )
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 1/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
= 1020 + 800
= 1820 [Ans]
Address of an element of any array say “A[ I ][ J ]” is calculated in two forms as given:
(1) Row Major System (2) Column Major System
The address of a location in Row Major System is calculated using the following formula:
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 2/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]
The address of a location in Column Major System is calculated using the following formula:
Where,
B = Base address
I = Row subscript of element whose address is to be found
J = Column subscript of element whose address is to be found
W = Storage Size of one element stored in the array (in byte)
Lr = Lower limit of row/start row index of matrix, if not given assume 0 (zero)
Lc = Lower limit of column/start column index of matrix, if not given assume 0 (zero)
M = Number of row of the given matrix
N = Number of column of the given matrix
Important : Usually number of rows and columns of a matrix are given ( like A[20][30] or A[40][60] ) but if it is
given as A[Lr- – – – – Ur, Lc- – – – – Uc]. In this case number of rows and columns are calculated using the
following methods:
And rest of the process will remain same as per requirement (Row Major Wise or Column Major Wise).
Examples:
Q 1. An array X [-15……….10, 15……………40] requires one byte of storage. If beginning location is 1500
determine the location of X [15][20].
Solution:
As you see here the number of rows and columns are not given in the question. So they are calculated as:
The given values are: B = 1500, W = 1 byte, I = 15, J = 20, Lr = -15, Lc = 15, M = 26
Address of A [ I ][ J ] = B + W * [ ( I – Lr ) + M * ( J – Lc ) ]
= 1500 + 1 * [(15 – (-15)) + 26 * (20 – 15)] = 1500 + 1 * [30 + 26 * 5] = 1500 + 1 * [160] = 1660 [Ans]
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 3/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
The given values are: B = 1500, W = 1 byte, I = 15, J = 20, Lr = -15, Lc = 15, N = 26
Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]
= 1500 + 1* [26 * (15 – (-15))) + (20 – 15)] = 1500 + 1 * [26 * 30 + 5] = 1500 + 1 * [780 + 5] = 1500 + 785
= 2285 [Ans]
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 4/4
1/29/2018 Sparse Matrices
Sparse Matrices :
Matrix with maximum zero entries is termed as sparse matrix.
Let us consider a sparse matrix from storage point of view. Suppose that the entire sparse matrix
is stored. Then, a considerable amount of memory which stores the matrix consists of zeroes. This
is nothing but wastage of memory. In real life applications, such wastage may count to
megabytes. So, an efficient method of storing sparse matrices has to be looked into.
A common way of representing non zero elements of a sparse matrix is the 3-tuple form. The
first row of sparse matrix always specifies the number of rows, number of columns and number of
non zero elements in the matrix.
The following program 1.1 accepts a matrix as input, which is sparse and prints the
corresponding 3-tuple representations.
/* The program accepts a matrix as input and prints the 3-tuple representation of it */
#include< stdio.h >
void main()
{
int a[5][5], rows, columns, i, j;
printf("enter the order of the matrix. The order should be less than 5 × 5:\n");
scanf("%d %d",&rows,&columns);
printf("Enter the elements of the matrix:\n");
for(i=0; i < rows; i++)
{
for(j=0; j< columns; j++)
{ scanf("%d",&a[i][j]);
}
printf(“The 3-tuple representation of the matrix is:\n”);
}
for(i=0;i< rows;i++)
{
for(j=0;j< columns;j++)
{ if (a[i][j]!=0) { printf("%d %d %d\n", (i+1),(j+1),a[i][j]);
}
}
}
Output :
Enter the order of the matrix. The order should be less than 5 × 5: 3 3
Enter the elements of the matrix: 1 2 3 0 1 0 0 0 4
The 3-tuple representation of the matrix is:
1 1 1
1 2 2
1 3 3
2 2 1
3 3 4
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Sparse-Matrices 1/1
1/29/2018 Address Calculation
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Address-Calculation 1/2
1/29/2018 Address Calculation
http://www.techoschool.com/MCA/Data-Structures-using-C/UNIT-1-Arrays_Address-Calculation 2/2
1/29/2018 PARWEZ'S BLOG: ADDRESS CALCULATION FOR TWO DIMENSIONAL ARRAY
W denotes the size, i.e; number of bytes per data element of the array A,
M is total numbers of rows, and N is total number of columns in the array.
In case of C language
LBR (Lower bound row) = 0
LBC (Lower bound column) = 0
e.g. Suppose element of array A[4][5] occupies 4 bytes, and the address of the 1st element is 49.
Find the address of the element A(4,3) when the storage is row major.
= BA + [n * (i - LBR) + (j - LBC)] * w
= 49 + [5 * (4 – 0) + (3 - 0)] * 4
= 49 + [23] * 4
= 49 + 92
= 141
http://pakhtar09.blogspot.in/2012/09/address-calculation-for-two-dimensional_29.html 1/1
1/29/2018 Memory Address Calculation in an Array – Guide For School
Array of an element of an array say “A[ I ]” is calculated using the following formula:
Address of A [ I ] = B + W * ( I – LB )
Where,
B = Base address
W = Storage Size of one element stored in the array (in byte)
I = Subscript of element whose address is to be found
LB = Lower limit / Lower Bound of subscript, if not specified assume 0 (zero)
Example:
Given the base address of an array B[1300…..1900] as 1020 and size of each element is 2 bytes in the memory.
Find the address of B[1700].
Solution:
Address of A [ I ] = B + W * ( I – LB )
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 1/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
= 1020 + 800
= 1820 [Ans]
Address of an element of any array say “A[ I ][ J ]” is calculated in two forms as given:
(1) Row Major System (2) Column Major System
The address of a location in Row Major System is calculated using the following formula:
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 2/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]
The address of a location in Column Major System is calculated using the following formula:
Where,
B = Base address
I = Row subscript of element whose address is to be found
J = Column subscript of element whose address is to be found
W = Storage Size of one element stored in the array (in byte)
Lr = Lower limit of row/start row index of matrix, if not given assume 0 (zero)
Lc = Lower limit of column/start column index of matrix, if not given assume 0 (zero)
M = Number of row of the given matrix
N = Number of column of the given matrix
Important : Usually number of rows and columns of a matrix are given ( like A[20][30] or A[40][60] ) but if it is
given as A[Lr- – – – – Ur, Lc- – – – – Uc]. In this case number of rows and columns are calculated using the
following methods:
And rest of the process will remain same as per requirement (Row Major Wise or Column Major Wise).
Examples:
Q 1. An array X [-15……….10, 15……………40] requires one byte of storage. If beginning location is 1500
determine the location of X [15][20].
Solution:
As you see here the number of rows and columns are not given in the question. So they are calculated as:
The given values are: B = 1500, W = 1 byte, I = 15, J = 20, Lr = -15, Lc = 15, M = 26
Address of A [ I ][ J ] = B + W * [ ( I – Lr ) + M * ( J – Lc ) ]
= 1500 + 1 * [(15 – (-15)) + 26 * (20 – 15)] = 1500 + 1 * [30 + 26 * 5] = 1500 + 1 * [160] = 1660 [Ans]
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 3/4
1/29/2018 Memory Address Calculation in an Array – Guide For School
The given values are: B = 1500, W = 1 byte, I = 15, J = 20, Lr = -15, Lc = 15, N = 26
Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]
= 1500 + 1* [26 * (15 – (-15))) + (20 – 15)] = 1500 + 1 * [26 * 30 + 5] = 1500 + 1 * [780 + 5] = 1500 + 785
= 2285 [Ans]
http://www.guideforschool.com/625348-memory-address-calculation-in-an-array/ 4/4
1/29/2018 Multidimensional Array: Address Calculation – UNCOVER YOUR SYLLABUS
Note: This article is pretty basic and I’ve used 2D array references.
The same goes for other multidimensional arrays too. If you’re not aware
of how we go about referring to particular elements in an array, I’d
recommend you brush your basics up. It’s pretty much like Mathematical
matrices. I have an example beside.
Okay, so I have before me an array and I’ve been given the base address
and I’m being asked to give the address of a particular element.
Most of the books give you formulae for calculating it without explaining what it means and how easy it is. The
formula is my method 1. In our Method 2,we’ll uncover it.
Our multidimensional array is nothing but just another linear array for
the computer.
As the name suggests, in Row major, consecutive elements of a row are stored
in contiguous locations in the memory; in column-major order, consecutive
elements of the columns are in contiguous locations.
Type 1: The number of rows, number of columns and the base address is known to you.Example: A 2-d
array[7×9] is given. Each element requires 2 bytes of space. Address of [1,1] is 1258(I made that up, it can be
anything maybe 1000 or something like that).
where S=size of the element, n=number of columns, r=lower limit of rows,c=lower limit of columns.
https://uncoveryoursyllabus.wordpress.com/2015/12/08/multidimensional-array-address-calculation/ 1/2
1/29/2018 Multidimensional Array: Address Calculation – UNCOVER YOUR SYLLABUS
Address=1258+2(9(5-1)+(8-1))=1258+2(9×4+7)=1344.
It’s stored row major wise so basically to reach [5,8] I have to travel 4 complete rows and then stop at the eighth
element in the third row. My one row had 9 columns. So altogether I skipped 9×4+7 elements to reach my
destination.
Address=1258+2(9×4+7)=1344.
Notice that my form is exactly the same as the formula. The reason is that the second method is actually a
proof of first method. The reason I asked you to do it the second way is because its more intuitive; where you
were being asked to arrange consecutive elements in a particular order and then perform simple arithmetic.
Type 2: An array is given in the form, [-15…20,15…40]. If base address is 100, calculate the address row major
wise of [15,20].
Note: The difference here is that my first element is not [0,0] but [-15,15]. This changes my lower limits. Last
element is [20,40]. So, it’s a pretty big array.
Address=100+2(26(15-(-15))+(20-15))=100+2(30×26+5)=1670
Method 2: We need to skip a total of 30 rows to reach row 15.(Wait, did you guess 29. Think a little. -15 row
also has to be skipped. It’s a total of 30.) That would mean skipping 30×26+5 elements.
So, address=100+2(30×26+5)=1670.
That’s it. You’ve finally learnt how to do it. Best of luck with your problem sets. It’s elementary stuff. Try out the
column major yourself.
I’ll give you the formula in case you want to check your answers.
where S=size of the element, n=number of rows, r=lower limit of rows, c=lower limit of columns.
https://uncoveryoursyllabus.wordpress.com/2015/12/08/multidimensional-array-address-calculation/ 2/2
1/29/2018 Data Structures: ADDRESS CALCULATION OF ARRAY ELEMENT A [J][K]
A[0][0] of A[M][N], and computes address Loc (A[J][K]) of A[M][N] using the formula
Column–Major Order:
OR
W denotes the size, i.e; number of bytes per data element of the array A, M is total numbers of rows, and N is total
number of columns in the array.
5 comments:
http://news401.blogspot.in/2009/10/address-calculation-of-array-element-jk.html 1/1
1/29/2018 programming centre: how to calculate the address of the 2D array
WHAT IS A 2D ARRAY?
A matrix (two dimensional array) is a group of lists, or arrays that are organized into one data set. To understand them,
first look an example of the standard one dimensional array:
Array "A":
16
8
99
0
5
You can reference any point in the "array" by naming the array and following it with a number representing the position
of a piece of data on the list. The first data on the array is represented with a "0", the second with a "1", and so on. For
example, A[2] (in bold) represents 99 because it is the third figure of array A. You could imagine the references of the
above table as the following:
Array "A":
[0]
[1]
[2]
[3]
[4]
Matrix "B":
16 17 9
8 88 74
99 12 21
0 6 40
5 19 18
There are 3 different arrays in a single data set, "B". In Array A, you could reference any data by naming the point on
the list, such as "1" or "3". However, with a matrix, you must give both a row and a column. You can reference data on
a matrix in the following format:
MatrixName[row][column]
http://programmingcentre.blogspot.in/2012/11/how-to-calculate-address-of-2d-array.html 1/2
1/29/2018 programming centre: how to calculate the address of the 2D array
For example, B[3][2] would represent 40 because it is the it is on the fourth row down and the third column. Remember,
matrix references also start at zero, not one! You can reference any of the data on this table with this chart:
Matrix "B":
[0][0] [0][1] [0][2]
[1][0] [1][1] [1][2]
[2][0] [2][1] [2][2]
[3][0] [3][1] [3][2]
[4][0] [4][1] [4][2]
Two-dimensional arrays are used everywhere, but are especially prevalent in computer programming and accounting
http://programmingcentre.blogspot.in/2012/11/how-to-calculate-address-of-2d-array.html 2/2