Ask Question
27 July, 18:24

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.

+1
Answers (1)
  1. 27 July, 18:48
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers