Question: 3. (25 points) Given a 2-D array of integers (e.g., int** arr) with m rows and m columns, implement a function that swaps arr[i][j] with

3. (25 points) Given a 2-D array of integers (e.g., int** arr) with m rows and m columns, implement a function that swaps arr[i][j] with arr[j] [i] in-place. (20 minutes) Use the function definition: void swap arr(int** arr, int m); Normally, a new 2-D array is created first (e.g., int** output arr = malloc(...)) and elements from the input array is moved to this new array one element at a time (i.e., output_arr[j] [i] arr[i][j]), and then output_arr copied back to arr. In this function, you CANNOT create a new array inside the function, and everything has to be done using the given input array (you are allowed to use a single temporary variable (e.g., int tmp;) to do a swap)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
