Min and Max of an array
Write a function that ﬁnds the maximum
and minimum elements of a two-dimensional array of integers.
This is what I have so far.

Getting a couple of errors in when compiled. 


#include <stdio.h>

#define ROWS 4
#define COLS 3
int max(int a[ROWS][COLS]);
int min(int a[ROWS][COLS]);

int main(void)
{
int a[ROWS][COLS];

int max, min, i,j;

printf("Input %d numbers for the array: ");
scanf("%d", &a[i][j]);

for (i = 0; i < ROWS; ++i){
        for (j = 0; j < COLS; ++j)
                printf("a[%d][%d] = %d  ", i, j, a[i][j]);
        printf("\n");
        }

max = max(a);
min = min(a);

printf("Max: %d\nMin: %d", max, min);

return 0;
}


int max(int a[ROWS][COLS])
{
   int i,j;
   int max = a[0][0];

   for(i = 0; i < 2; i++)
      for(j = 0; j < 5; j++)
         if(a[i][j] > max)

 {
            max = a[i][j];
         }
   return max;
}

int min(int a[ROWS][COLS])
{
int i,j;
int min = a[0][0];

for(i = 0; i < 2; i++)
        for(j = 0; j < 5; j++)
                if(a[i][j] < min)
                        {
                        min = a[i][j];
                        }
return min;
}

Min and Max of an array
===

Write a function that ﬁnds the maximum
and minimum elements of a two-dimensional array of integers.
This is what I have so far.

Getting a couple of errors in when compiled. 


#include <stdio.h>

#define ROWS 4
#define COLS 3
int max(int a[ROWS][COLS]);
int min(int a[ROWS][COLS]);

int main(void)
{
int a[ROWS][COLS];

int max, min, i,j;

printf("Input %d numbers for the array: ");
scanf("%d", &a[i][j]);

for (i = 0; i < ROWS; ++i){
        for (j = 0; j < COLS; ++j)
                printf("a[%d][%d] = %d  ", i, j, a[i][j]);
        printf("\n");
        }

max = max(a);
min = min(a);

printf("Max: %d\nMin: %d", max, min);

return 0;
}


int max(int a[ROWS][COLS])
{
   int i,j;
   int max = a[0][0];

   for(i = 0; i < 2; i++)
      for(j = 0; j < 5; j++)
         if(a[i][j] > max)

 {
            max = a[i][j];
         }
   return max;
}

int min(int a[ROWS][COLS])
{
int i,j;
int min = a[0][0];

for(i = 0; i < 2; i++)
        for(j = 0; j < 5; j++)
                if(a[i][j] < min)
                        {
                        min = a[i][j];
                        }
return min;
}
