Professional Documents
Culture Documents
Array: by Debraj Chatterjee
Array: by Debraj Chatterjee
By Debraj Chatterjee
What is an array ?
• An array is a variable that can store multiple values. For
example, if you want to store 100 integers, you can create an
array for it.
• Array is a collection of homogeneous elements.
Cont…
{3, 1, 4, 9}}};
Row major & column major order
• In computing, row-major order and column-major order are
methods for storing multidimensional arrays in linear storage such
as random access memory.
• The difference between the orders lies in which elements of an
array are contiguous in memory.
• In row-major order, the consecutive elements of a row reside next
to each other,
• Whereas the same holds true for consecutive elements of a column
in column-major order.
Problem:
Calculate the address of an element from an array [20X5] with a
given location [18X4].
Prerequisites: Base Address=1000;
No of words/memory location=2;
A[I][J]= BA+{I*N+J}*SIZE OF DATA TYPE
A[18][4]= 1000+{18*5+4}*2
=1000+94*2
=1000+188=1188