I have a data file containing 12 months of daily temperatures. I want the program to get the minimum and maximum temperature for each month using functions and printing in the main function. Somehow my function declarations and definitions are not accepted (following a tutorial I have). I tried to modify the program in the post here: Using a 2D Array in Function: Error, my program gets worse. Help needed. Here is the code
#include <stdio.h>
#include<stdlib.h>
  /* function declarations */
float max(float temp[][]);
float min(float temp[][]);
int main ()
{
    float maxt, temp[31][12];
    int i, j, year, month;
    char value, buff[1000];
    FILE *f1;
    FILE *f2;
    f1=fopen("temp_data.txt", "r");
    f2=fopen("temp_out.txt", "w");
    if (f1 == NULL)
    {
        printf("Can't open file\n",f1);
        return 1;
    }
    if (f2 == NULL)
    {
        printf("Can't open file\n",f2);
        return 1;
    }
    j=0;
    while (fgets(buff, sizeof(buff), f1))
    {
        sscanf(buff, " %i %i", &year, &month);
        for (i = 0; i <= 31; i++)
        {
          sscanf(buff, " %f", &temp[i][j]);
        }
        for(i = 0; i < 31; i++)
        {
            /* calling a function to get max value */
            float maxt = max(temp);
            float mint = min(temp);
            printf( " %d Min=%5.1f Max=%5.1f\n", j, mint, maxt);
        }
        j=j+1
    }
    return 0;
}
/* function returning the max of 31 temperatures */
float max(float temp[][])
{
 /* local variable declaration */
 float maxt;
 maxt=-99.;
 int i,j;
 for(i = 0; i < 31; i++)
 {
  if(temp[i][j] > maxt)
  {
     maxt=temp[i][j];
  }
 }
 return maxt;
 }
/* function returning the max of 31 temperatures */
float min(float temp[][])
{
 /* local variable declaration */
 float mint;
 mint=99.;
 int i,j;
 for(i = 0; i < 31; i++)
 {
  if(temp[i][j] < mint)
  {
     mint=temp[i][j];
  }
 }
 return mint;
 }
Here is my data
 2012  01    29.6    32.2    32.5    32.7    31.0    28.0    29.6    30.0    32.0    30.5    32.0    27.5    27.8    30.0    30.5    28.6    30.5    29.0    29.7    30.0    32.2    31.6    29.5    31.0    31.5    30.0    29.5    32.0    32.3    32.5    27.7
 2012  02    32.2    30.5    32.0    32.6    30.0    32.4    33.0    29.8    32.0    33.0    30.2    29.0    29.2    31.0    27.5    31.0    28.0    25.0    25.8    28.5    32.3    31.0    29.0    31.3    30.5    28.1    30.0    29.2    26.3   999.9   999.9
 2012  03    23.5    30.5    30.8    30.2    29.7    30.0    29.0    28.3    31.8    31.3    31.6    31.4    32.0    33.5    31.6    33.0    33.4    32.7    30.6    32.5    30.5    33.0    32.5    30.0    23.7    28.3    29.5    32.0    33.6    33.5    29.5
 2012  04    29.8    30.5    30.3    32.1    27.5    29.0    29.6    29.7    30.5    32.6    31.8    30.5    30.1    29.7    24.5    25.6    29.6    30.2    30.0    30.4    30.0    31.1    31.2    28.4    30.2    31.2    30.0    30.6    31.8    28.3   999.9
 2012  05    30.2    28.4    30.7    26.8    27.6    29.8    29.0    27.5    30.0    27.0    27.2    30.5    29.5    28.7    29.8    29.5    30.7    30.8    30.5    31.5    29.0    30.6    31.6    30.5    30.7    31.0    30.8    29.5    29.0    30.6    31.0
 2012  06    30.8    30.2    30.5    28.0    29.8    30.3    30.3    31.0    31.3    32.2    31.0    30.3    30.4    30.8    31.0    29.5    30.0    30.1    30.0    30.5    30.5    31.0    31.2    31.5    31.1    26.9    25.3    30.0    30.7    29.2   999.9
 2012  07    28.8    31.3    32.0    31.5    30.7    30.9    30.5    31.3    31.5    32.6    31.3    31.1    31.2    31.0    30.5    32.0    32.5    30.7    30.2    30.4    31.0    31.4    31.6    30.6    30.7    30.0    28.8    29.1    30.8    31.0    30.2
 2012  08    32.0    31.6    32.4    32.2    32.5    32.7    33.8    27.5    29.5    31.6    31.7    32.0    32.3    33.0    31.8    33.4    34.0    32.8    33.0    32.4    33.0    33.2    34.1    34.3    34.6    34.8    28.0    32.2    32.5    27.5    31.8
 2012  09    33.0    30.4    29.5    31.6    31.8    30.2    31.0    32.0    29.0    25.0    31.4    28.8    29.0    30.6    30.3    31.0    32.2    30.0    31.0    32.1    33.5    33.2    34.0    33.0    32.4    31.0    31.2    32.4    32.8    33.0   999.9
 2012  10    30.5    31.5    32.5    32.3    33.1    32.0    31.7    31.5    32.2    30.3    31.0    28.2    31.0    30.8    33.0    31.3    31.8    31.5    28.0    30.6    31.2    30.6    31.8    31.4    25.0    30.8    30.3    31.0    32.0    31.6    29.4
 2012  11    29.0    28.0    29.8    28.6    26.7    29.5    25.7    31.5    27.0    29.4    30.0    32.7    32.5    30.7    29.5    29.6    29.0    30.0    29.0    28.5    28.8    29.6    28.1    28.8    28.5    29.3    30.7    28.0    29.5    30.3   999.9
 2012  12    30.8    32.6    28.6    31.3    23.7    27.3    27.0    28.5    32.1    29.5    28.7    31.0    27.3    30.1    27.8    29.2    29.5    30.0    29.3    32.4    30.0    29.3    29.5    30.1    29.4    28.8    30.4    29.5    29.2    27.3    29.3
errors in function declarations: "array type has incomplete element type" errors in function definitions: "type of forma parameter 1 is incomplete" "two few arguments to function 'min', 'max'" and "conflicting types for 'min', 'max'" also 'j' undeclared here (not in a function
Help will be appreciated.
 
    