title: Using a function and an array to get the maximum and minimum value
body: <p>I am having some trouble getting my program to find the maximum and minimum values for a set of students GPA's. I can do this easily without using a function but when I include the function my program still runs fine but it does not calculate the maximum and minimum GPA's. I have debugged it as well and by the looks of things the program simply runs straight over it without looking at it. Your help would be greatly appreciated. This is what my code currently looks like: </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  float array(int arr[], int size)
  {
      float max = 0;
      float min = 4;
      int i;
  
      for (i = 0; i &lt;= 2; i++)
      {
          if (arr[i] &gt; max)
              max = arr[i];
  
          if (arr[i] &lt; min)
              min = arr[i];
      }
      cout &lt;&lt; "Maximum GPA: " &lt;&lt; max;
      cout &lt;&lt; "Minimum GPA: " &lt;&lt; min;
  
  }
  int main(int argc, char** argv)
  {
      int ID[3];
      float GPA[3];
      int i;
  
      for (i = 0; i &lt;= 2; i++)
      {
          cout &lt;&lt; "Please enter student ID and GPA: " &lt;&lt; endl;
          cin &gt;&gt; ID[i] &gt;&gt; GPA[i];
          array[GPA, i];
      }
      for (i = 0; i &lt;= 2; i++)
      {
          cout &lt;&lt; endl &lt;&lt; "Student ID: " &lt;&lt; ID[i] &lt;&lt; endl &lt;&lt; "Student GPA: " &lt;&lt; GPA[i] &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>