title: "Array subscript is not an integer" in C program
body: <p>The <code>deviation</code> function throws me the following error: <code>"Array subscript is not an integer"</code>. If you can help me locate the cause of error I'll appreciate it.</p>
  
  <pre><code>float average(float data[], int n) {
      float total = 0;
      float *p = data;
  
      while (p &lt; (data + n)) {
          total = total + *p;
          p++;
      }
  
      return total / n;
  }
  
  float deviation(float data[], int n) {
      float data_average = average(data, n);
      float total;
      float *p = data;
  
      while (p &lt; (data + n)) {
          total += (data[p] - data_average) * (data[p + 1] - data_average);
      }
  
      return total / 2;
  }
  </code></pre>