title: I want position, but I get ncols and nrows of array
body: <p>I'm a student, and I'm trying to get the last piece of code working on my assignment. This has been asked a million times, but I haven't been able to find a solution that works for me. I can only get the last position of the array to print when I run this program. I can't use any shortcuts (vectors, maxelement(), etc).  Can anyone help?</p>
  
  <pre><code>#define inputfile "C:\\C_txt_files\\wind.txt"
  
  int i, j, nrows, ncols;
  double wind_max, wind_min, wind_array[12][5], index_minmonth=0, 
         index_minyear=0, index_maxmonth=0, index_maxyear=0;
  
  fscanf(wind, "%d %d", &amp;nrows, &amp;ncols);
  
  /*Find Min and Max, and Compute average for each row. Locate Min and Max*/
  wind_min = wind_array[0][0];
  wind_max = wind_array[0][0];
  for(i=0; i&lt;nrows; i++)
  {
  for(j=0; j&lt;ncols; j++)
  {   
      if(wind_array[i][j]&lt;wind_min)
         wind_min = wind_array[i][j];
         index_minmonth = i;
         index_minyear = j;
      if(wind_array[i][j]&gt;wind_max)
         wind_max = wind_array[i][j];
         index_maxmonth = i;
         index_maxyear = j;      
  }
  }
  index_minmonth += 1;
  index_minyear += 1;
  index_maxmonth += 1;
  index_maxyear += 1;
  printf("Minimum speed is %2.0f mph in month %2.0f, year %1.0f.\n", wind_min, 
        index_minmonth, index_minyear);
  printf("Maximum speed is %2.0f mph in month %2.0f, year %1.0f.", wind_max, 
        index_maxmonth, index_maxyear);
  </code></pre>
  
  <p>This is what prints:
  Minimum speed is  5 mph in month 12, year 5.
  Maximum speed is 12 mph in month 12, year 5.</p>