title: How can I average a subset of an array and store the result in another array?
body: <p>I have a C array <code>fftArray[64]</code> that contains values that I want averaged and placed into another array <code>frequencyBar[8]</code>. Getting the average of the entire array would be easy enough using a for statement. </p>
  
  <pre><code>int average, sum = 0;
  for (i = 0; i &lt; 64; i++)
  {
       sum += fftArray[i];
  }
  average = sum/64;
  </code></pre>
  
  <p>But I just can't seem to figure out how to get the average from <code>fftArray[0]</code> through <code>fftArray[8]</code> and store this in <code>frequencyBar[0]</code>, the average of <code>fftArray[9]</code> through <code>fftArray[16]</code> and store this in <code>frequencyBar[1]</code>, etc. Can anyone help me out with this? Thanks</p>