# c saddle element in matrix

 Danny AA · December 22, 2014 int CheckSaddleElement(int mat[][COLS], int rows){ int i=0, j=0, k=0; int min = 0, max = 0, col = 0; for (i = 0; i < rows; i++) { min = mat[0]; for (j = 0; j < 10; j++) { if (mat[j] <= min) { min = mat[j]; } col = j; } max = mat[0] ; for (k = 0; k < rows; k++) { if (mat[k] >= max) max = mat[k] ; } } if (max == min) return 1; return 0;I don't know why it doesn't work.....I need help pls}

## Replies

 Danny AA · December 22, 2014 can someone help me with that pls? Franz Schmidt · December 22, 2014 Could you please explain what we are supposed to help you with?Sorry but we can't read your mind Danny AA · December 22, 2014 i need to make a func that find the smallest number in rows and biggest number in columns in a given matrix. Franz Schmidt · December 22, 2014 You mean something like this?http://textuploader.com/6s7bOr sth. different? Danny AA · December 23, 2014 1 2 0 3 9 4 5 3 6 72 4 3 5 9 0 2 3 4 15 3 4 7 6 1 9 0 4 2 6 9 7 8 6 7 7 4 5 68 3 1 9 2 0 6 2 8 22 7 3 0 3 6 3 1 5 38 2 5 9 7 7 8 3 7 31 7 4 8 5 8 5 0 0 6that's tha matrix and the func need to return 1 cuz there is a saddle element.which is number 4.row 3 column 7.int checkSaddleElement (int mat[][COLS], int ros);i have tried your func and it doesn't work.tnx for your help. Franz Schmidt · December 30, 2014 Ok now I understand what you mean Look if it works: https://paste.ab-storm.de/view/167976081c965cea485999cbe13ce336 Danny AA · December 31, 2014 both of them are working great,Thanks for your help....
• 1

## C

130,057 followers