Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN C LANGUAGE (10 points) Beunding Velume Restring Assuming that your alloeation

ID: 3904389 • Letter: I

Question

IN C LANGUAGE

(10 points) Beunding Velume Restring Assuming that your alloeation will not fail e you don't need to check foe NULL pointers) write a method that resizes a 3 dimensional amay whose 12 andions are the coondinate, the y coordinate, and the indices of overlapping ones (respectively) You will only resize on the y coordinate.Fill any newly allocated values with IMPOSSIBLE intreeieY(int eurx, int oldy, int nevr, int curoverlap, int board) int 1, 3. ntret, 1/ In case you don t want to use board /7 Your Code here

Explanation / Answer

int ***resize(int curx, int oldy, int newY, int overlap, int ***board){

        int *** array = (int ***)malloc(curx*sizeof(int**));

        for (i = 0; i< curx; i++) {

         array[i] = (int **) malloc(newY*sizeof(int *));

          for (j = 0; j < newY; j++) {

              array[i][j] = (int *)malloc(overlap*sizeof(int));
          }

        }
        for (int i = 0; i<curX; i++){
            for (int j = 0; j<oldY; j++){
                for (int k = 0; k<overlap; k++){
                    array[i][j][k] = board[i][j][k];
                }
            }
        }
        board = array;
        return board;