Book Your slot
X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
search
Menu Login home
  • Questions

  • Library

  • University Updates

  • Informatives

  • Technology Lines

  • Training & Internships

  • X
    Menu
  • Home
  • Privacy Policy
  • Legal Disclaimer
  • Terms & Conditions
  • Return Policy
  • About Us
  • Need any help?? write to us at

    support@engineershub.co

    Follow Us

    X
    LOGIN
    Login to access posts, links, updates, question papers, materials, one liners!
    Use Your Email Address/Mobile and Password to Login
    Forgot Password?
    Not a member? Sign Up
    LOGIN WITH EMAIL/MOBILE
    Forgot Password?
    Go Back
    FORGOT PASSWORD
    Go Back
    RESET PASSWORD
    Go Back
    Continue with LinkedIn
    OR
    Fill Up a Simple Form
    Already a Member? Login
    SIGN UP
    Fill all the below details correctly and click on Next
    Go Back
    Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array? - EngineersHub
    Go Back
    Question
    Arunbavu Arun
    3 years ago
    1 Answer(s) posted Write an answer 7208
    Answer
    Read Mode
    Answer posted by Ruchitha
    3 years ago

    These are stored in the memory as given below.

    1) Row-Major order Implementation

    2) Column-Major order Implementation

    In Row-Major Implementation of the arrays, the arrays are stored in the memory in terms of the row design, i.e. first the first row of the array is stored in the memory then second, and so on.

    Suppose we have an array named arr having 3 rows and 3 columns then it can be stored in the memory in the following manner :

    int arr[3][3];

    Thus an array of 3*3 can be declared as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with row-major implementation as follows :

    In Column-Major Implementation of the arrays, the arrays are stored in the memory in the term of the column design, i.e. the first column of the array is stored in the memory than the second, and so on. By taking the above eg. we can show it as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with column-major implementation as follows :

    Two-dimensional arrays of variable length

    An array consisting of two subscripts is known as a two-dimensional array. These are often known as an array of the array. In two-dimensional arrays, the array is divided into rows and columns,.

    These are well suited to handle the table of data. In a 2-D array, we can declare an array as :

    Declaration:-

    Syntax: data_type array_name[row_size][column_size];

    Ex: int arr[3][3] ;

    Where first index value shows the number of the rows and the second index value shows the no. of the columns in the array.

    These are stored in the memory as given below.

    Initialization:-

    To initialize values for variable-length arrays we can use scanf statement and loop constructs.

    Ex:-

    for ( i=0 ; i<3; i++ )

    for( j=0;j<3;j++ )

    scanf( “ %d ”,&arr[i][j] );

    X
    Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array?
    X
    Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array?

    These are stored in the memory as given below.

    1) Row-Major order Implementation

    2) Column-Major order Implementation

    In Row-Major Implementation of the arrays, the arrays are stored in the memory in terms of the row design, i.e. first the first row of the array is stored in the memory then second, and so on.

    Suppose we have an array named arr having 3 rows and 3 columns then it can be stored in the memory in the following manner :

    int arr[3][3];

    Thus an array of 3*3 can be declared as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with row-major implementation as follows :

    In Column-Major Implementation of the arrays, the arrays are stored in the memory in the term of the column design, i.e. the first column of the array is stored in the memory than the second, and so on. By taking the above eg. we can show it as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with column-major implementation as follows :

    Two-dimensional arrays of variable length

    An array consisting of two subscripts is known as a two-dimensional array. These are often known as an array of the array. In two-dimensional arrays, the array is divided into rows and columns,.

    These are well suited to handle the table of data. In a 2-D array, we can declare an array as :

    Declaration:-

    Syntax: data_type array_name[row_size][column_size];

    Ex: int arr[3][3] ;

    Where first index value shows the number of the rows and the second index value shows the no. of the columns in the array.

    These are stored in the memory as given below.

    Initialization:-

    To initialize values for variable-length arrays we can use scanf statement and loop constructs.

    Ex:-

    for ( i=0 ; i<3; i++ )

    for( j=0;j<3;j++ )

    scanf( “ %d ”,&arr[i][j] );

    EngineersHub Logo
    x
    Loading...