hi! i have a problem here because the method doesn't work properly, the point of the code is to tell the minimun value in the given matrix "m", it's supposed to take the first value of the matrix store it in min_ and then compare it to every value of the matrix, if the value stored in min_ is bigger than the current value in the loop then it's stored as the new min_ and at the end it's supposed to print that minimum... i'd really appreciate the help! thanks!
Code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 3
void minimum (int mat[SIZE][SIZE]){
int r,c;
int min_;
printf("\n");
min_=mat[0][0];
for (r=0;r<SIZE;r++){
for (c=0;c<SIZE;c++){
if (min_>=mat[r][c]){
min_=mat[r][c];
}
}
}
printf("The minimum value of the matrix is: %i\n", min_);
}//minimum
int main()
{
printf("HW #3 :) .\n\n");
int m[SIZE][SIZE]={{1,2,3},
{4,5,6},
{7,8,9}};
minumum(m);
return 0;
}