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

The sum of two numbers is 18. There difference is eight. If the numbers are x and y, write a system of equations to describe their sum and their difference.
The area around Istanbul, the Bosporus, and Asia Minor are now part of the country of: Egypt Turkey Greece Thrace
Who is the governor of the bank of Canada
Otis Oompah has an orange face and is married to an orange faced Oompah. They have 8 children. How many children will have blue faces?
If (7, 2) is an ordered pair of the function f(x), which of the following must be an ordered pair of the inverse of f(x)?
lucia is wrapping packages that are in the shape of a triangular prism.the net of the prism is shown below. lucia has 6 packages to wrap.what is the combined su
What is the correct way to assign the word "hello" to a variable?
is frankestien a appositive
What two gasses probably dominated Precambrian Earth's atmosphere
area of rectangle is 40 inches perimeter is 48 inches what length are the sides