• Top Posts

    Multi Dimensional Arrays as arguments to Methods


    • Can also pass the multidimensional arrays to a method. There are various options like first, you declare and initialize the multi-dimensional array separately then pass it the to the method. Second, you can declare, initialize and pass the array to the method in a single line of code.
    • Declaring and initialising array first and then pass it to the method as an argument.

    int[,] arr = { {1, 2, 3, 4}, {5, 6, 7, 8} };
    Result(arr);
    • Declaring, initializing and passing the 2-D array to the method in a single line of code.
                      Result (new int[,] { {1,2,3,4}, {5,6,7,8  } } );
            

    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728