Question: Given the declarations below representing 5x4 2D arrays, select all of the statements that will set the 3rd row, 4th element of the arrays to

Given the declarations below representing 5x4 2D arrays, select all of the statements that will set the 3rd row, 4th element of the arrays to 5.

int numbers1[5] [4]; int * numbers2 = malloc (5*4*sizeof(int)); int ** numbers3

  1. numbers 1 [2] [3] = 5;
  2. numbers 2 [2 * 4 + 3] = 5;
  3. numbers 3 [2] [3] = 5;
  4. numbers 1 [2 x 4 + 3] = 5;
  5. numbers 2 [2][3] = 5;
  6. numbers 3 [2 * 4 + 3] = 5;

int numbers1[5] [4]; int * numbers2 = malloc (5*4*sizeof(int)); int ** numbers3 = malloc (5 * sizeof(int *)); for (int r = 0; r < 5; r++) { numbers3[r] malloc(4 *sizeof(int)); }

Step by Step Solution

3.42 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To set the 3rd row and 4th element of the arrays to 5 lets examine each statement 1 numbe... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!