kekerice1327 kekerice1327
  • 18-10-2019
  • Computers and Technology
contestada

Consider

int[][] a = {{1,2},{3,4,5}};
int[] b = a[1];
b[0] = 10;

What are the indices i and j of the array element a[i][j] that is equal to 10 after the above code fragment is executed?

Respuesta :

lmcoronadom
lmcoronadom lmcoronadom
  • 18-10-2019

Answer:

i = 1

j = 0

a[1][0] = 10

Explanation:

First define a matrix a that correspond to

 [1,2]

 [3,4,5]

Later the variable b point to the a[1]

 b = [3,4,5]

Later change the value 0 of b

 b = [10,4,5]

The final matrix is

     0     1      2

0  [  1     2 ]

1   [ 10    4    5 ]

And then the 10 value is located in a[1][0]

Answer Link

Otras preguntas

What is 32 over 48 simplified and with what numbers
why does the earth not lose its heat as quickly at night as the moon does?
why does the earth not lose its heat as quickly at night as the moon does?
one number is 6 more than another.  Their product is is 520.  Find the numbers
how many stars are there in america's flag ?
What is 32 over 48 simplified and with what numbers
How do you do y divided by 9=12?
one number is 6 more than another.  Their product is is 520.  Find the numbers
why does the earth not lose its heat as quickly at night as the moon does?
one number is 6 more than another.  Their product is is 520.  Find the numbers