Ask Question

Multidimensional arrays can be stored in row major order, as in C, or in column major order, as in Fortran. Develop the access functions for both of these arrangements for three-dimensional arrays.

+2
Answers (1)
  1. 19 January, 22:35
    0
    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Multidimensional arrays can be stored in row major order, as in C, or in column major order, as in Fortran. Develop the access functions ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers