Answer:
Access functions explained below
Explanation:
Access functions for Three Dimensional Arrays:
Let M, N and P refer to the size of the 1st 2nd and 3rd dimensions respectively.
Element_Size is the memory size the array element.
Generic access functions for Row Major:
If character data is used then Element_Size is 1.
For i=0 to P do
For i=0 to N do
For i=0 to M do
Address_of _array[i, j, k] = address_of_array[0,0,0] + (i * P + j * N + k) * Element_Size
Store data into the Address_of _array[i, j, k]
Or
Display data from Address_of _array[i, j, k]
end
end
end
Generic access function for Column Major:
if For i=0 to M do
For i=0 to N do
For i=0 to P do
Address_of _array[i, j, k] = address_of_array[0,0,0] + (i * M + j * N + k) * Element_Size
Store data into the Address_of _array[i, j, k]
Or
Display data from Address_of _array[i, j, k]
end
end
end