USE C PROGRAMMING, call all functions in main, and use a 2 by 3 2d array...

50.1K

Verified Solution

Question

Programming

USE C PROGRAMMING, call all functions in main, and use a 2 by 32d array to test, thanks.

get_location_of_min This function takes amatrix as a 2-D array of integers with NUM_COLS width, the numberof rows in the matrix and two integer pointers. The function findsthe location of the minimum value in the matrix and stores the rowand column of that value to the memory location pointed to by thepointer arguments. If the minimum value occurs in more than onerow, the function choses the one with the highest row number. Ifthe minimum value occurs more than once in that row, the functionchose the one with the highest column number. You can assume thematrix is not empty. Examples: if get_location_of_min is calledwith matrix {{1,7},{4,2},{2,-1}}, and NUM_COLS is 2, the number ofrows is 3 the smallest value (-1) is at row 2 column 1. After thefunction is complete the values 2 and 1 are stored at thecorresponding locations pointed to by the arguments. ifget_location_of_min is called with matrix {{3,7},{4,2},{2,6}}, andNUM_COLS is 2, the number of rows is 3 the smallest value (2)occurs twice and the one at the highest row is at row 2 column 0.After the function is complete the values 2 and 0 are stored at thecorresponding locations pointed to by the arguments. ifget_location_of_min is called with matrix {{3,7},{2,4},{2,2}}, andNUM_COLS is 2, the number of rows is 3 the smallest value (2)occurs three times and the one at the highest row and column is atrow 2 column 1. After the function is complete the values 2 and 1are stored at the corresponding locations pointed to by thearguments.

get_location_of_max This function takes amatrix as a 2-D array of integers with NUM_COLS width, the numberof rows in the matrix and two integer pointers. The function findsthe location of the minimum value in the matrix and stores the rowand column of that value to the memory location pointed to by thepointer arguments. If the minimum value occurs in more than onerow, the function choses the one with the highest row number. Ifthe minimum value occurs more than once in that row, the functionchose the one with the highest column number. You can assume thematrix is not empty. Examples: if get_location_of_max is calledwith matrix {{1,7},{4,2},{2,9}}, and NUM_COLS is 2, the number ofrows is 3 the largest value (9) is at row 2 column 1. After thefunction is complete the values 2 and 1 are stored at thecorresponding locations pointed to by the arguments. ifget_location_of_max is called with matrix {{3,7},{4,8},{8,6}}, andNUM_COLS is 2, the number of rows is 3 the largest value (8) occurstwice and the one at the highest row is at row 2 column 0. Afterthe function is complete the values 2 and 0 are stored at thecorresponding locations pointed to by the arguments. ifget_location_of_max is called with matrix {{3,7},{8,4},{8,8}}, andNUM_COLS is 2, the number of rows is 3 the largest value (8) occursthree times and the one at the highest row and column is at row 2column 1. After the function is complete the values 2 and 1 arestored at the corresponding locations pointed to by thearguments.

swap_min_max_values This function takes amatrix as a 2-D array of integers with NUM_COLS width, the numberof rows in the matrix. The function will find the locations of theminimum and maximum values and swap the locations of these valuesin the matrix. The locations of minimum and maximum values followthe specifications of the get_location_of_min andget_location_of_max functions. You can assume the matrix is notempty. Examples: if get_location_of_max is called with matrix{{1,7},{4,2},{2,9}}, and NUM_COLS is 2, the number of rows is 3.The minimum value (1) and is at row 0 column 0 and the largestvalue (9) is at row 2 column 1. After the function is completematrix is {{9,7},{4,2},{2,1}}.

Answer & Explanation Solved by verified expert
3.9 Ratings (786 Votes)
CODEOUTPUTRawCodeincludedefine    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students