title: Finding max value in an array
body: <p>If I have an array, e.g.</p>
  <blockquote>
  <p>10, 4, 7, 8</p>
  </blockquote>
  <p>The value of the maximum element is</p>
  <blockquote>
  <p>10</p>
  </blockquote>
  <p>How can I find this value?</p>
  <hr />
  <p>Here's my attempt:</p>
  <pre><code>int highNum = 0;
  int m;
  int list[4] = {10, 4, 7, 8};
      for (m = 0 ; m &lt; size ; m++);
      {
          if (list[m] &gt; highNum)
              highNum = list[m];
              cout &lt;&lt; list[m];
      }
  cout &lt;&lt; highNum;
  </code></pre>
  <p>I am trying to write a simple loop to store a max value from an array, and I wrote this thinking it would work, but for some reason at the beginning of the for loop it stores the m variable as 4 and exits the loop.</p>