Given the following 2D array int array 3 7 8 5 1 3 2 0 4
Given the following 2-D array int[][] array = { { 3, 7, 8}, {5, 1, 3}, {2, 0, 4}, {9, 1, 6}}; What value is stored in array[2][1]?
Solution
In a Multi-Dimensional Array, we declare and Access the Arrays using the Rows and Columns.
We have the given Array:
int[][] array = {{ 3, 7, 8}, {5, 1, 3}, {2, 0, 4}, {9, 1, 6}};
For your better understanding write it like this:
int[][] array = {
{ 3, 7, 8},
{5, 1, 3},
{2, 0, 4},
{9, 1, 6} };
This given array has Rows and each row has 3 elements, now to access any of the elements we use the array name and then the
[Row Number] [Element Number]
Here the name of the array is array itself, Now,
array [2][1] will access the 2nd row, and 1st element of it.
So, in the 2nd Row we have, {5,1,3}, and the first element is 5
So, array [2][1] will return the 1st element of 2nd Row, that is \"5\".
This is all for the given question.
Thank You for using Chegg...
![Given the following 2-D array int[][] array = { { 3, 7, 8}, {5, 1, 3}, {2, 0, 4}, {9, 1, 6}}; What value is stored in array[2][1]?SolutionIn a Multi-Dimensional Given the following 2-D array int[][] array = { { 3, 7, 8}, {5, 1, 3}, {2, 0, 4}, {9, 1, 6}}; What value is stored in array[2][1]?SolutionIn a Multi-Dimensional](/WebImages/35/given-the-following-2d-array-int-array-3-7-8-5-1-3-2-0-4-1103355-1761583452-0.webp)