#include #include #define NUM_ROW 4 #define NUM_COL 4 // sum_min should return the sum of // the minimum values in each row of the array int min_row_sum(int size, int array[NUM_ROW][NUM_COL]) { int sum = 0; // outer loop: process all the rows int row = 0; while (row < NUM_ROW) { // find the smallest value in this row int min = array[row][0]; int col = 1; while (col < NUM_COL) { if (array[row][col] < min) { min = array[row][col]; } col++; } // min should have the smallest value from // the row sum += min; row++; } return sum; } // This is a simple main function which could be used // to test your sum_min function. // It will not be marked. // Only your sum_min function will be marked. int main(void) { int test_array[NUM_ROW][NUM_COL] = { {1, 2, 3, 4}, // row 0, find min, check all the cols {4, 2, 2, 0}, {9, 9, 9, 9}, {5, 2, 5, 5} }; int result = min_row_sum(NUM_COL, test_array); printf("%d\n", result); return 0; }