title: What is causing format specifier error in C?
body: <pre><code>#include &lt;stdio.h&gt;
  
  
  #define MAXPOINTS 10000
  
  // compute the average of the first num_items of buffer
  double avg(double buffer[], int num_items);
  
  //update the max and min of the first num_items of array
  void maxmin(double array[], int num_items, double* max, double* min);
  
  //shift length-1 elements of the buffer to the left and put the 
  //new_item on the right.
  void updatebuffer(double buffer[], int length, double new_item);
  
  
  
  int main(int argc, char* argv[]) 
  {
  
      /* DO NOT CHANGE THIS PART OF THE CODE */
      double x[MAXPOINTS], y[MAXPOINTS], z[MAXPOINTS],num_z,num_y,num_x,avg_x,avg_y,avg_z,max_x,max_y,max_z,min_x,min_y,min_z;
      int lengthofavg = 0;
      if (argc&gt;1) {
          sscanf(argv[1], "%d", &amp;lengthofavg );
          printf("You entered a buffer length of %d\n", lengthofavg);
      }
      else {
          printf("Enter a length on the command line\n");
          return -1;
      }
      if (lengthofavg &lt;1 || lengthofavg &gt;MAXPOINTS) {
          printf("Invalid length\n");
          return -1;
      }
      /* PUT YOUR CODE HERE */
      double max;
      double min;
      int b_up, b_down,b_left,b_right,time;
      double ax,ay,az;
  
      int i; 
  
      for(i=0;i&lt;lengthofavg;i++)
  
      {
          scanf("%d, %lf, %lf, %lf, %d, %d, %d, %d", &amp;time, &amp;a_x, &amp;a_y, &amp;a_z, &amp;Button_UP, &amp;Button_DOWN, &amp;Button_LEFT, &amp;Button_RIGHT);
          x[i] = num_x; 
          y[i] = num_y; 
          z[i] = num_z; 
      }
  
  
      while(1)
      {
  
          scanf("%d, %lf, %lf, %lf, %d, %d, %d, %d", &amp;time, &amp;a_x, &amp;a_y, &amp;a_z, &amp;Button_UP, &amp;Button_DOWN, &amp;Button_LEFT, &amp;Button_RIGHT);
          updatebuffer(x, lengthofavg, num_x);
          updatebuffer(y, lengthofavg, num_y);
          updatebuffer(z, lengthofavg, num_z);
  
          avg_x= avg(x, lengthofavg);
          avg_y = avg(y, lengthofavg);
          avg_z = avg(z, lengthofavg);
  
          maxmin(x, lengthofavg, &amp;max_x, &amp;min_x);
          maxmin(y, lengthofavg, &amp;max_y, &amp;min_y);
          maxmin(z, lengthofavg, &amp;max_z, &amp;min_z);
  
          printf("%lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf\n", num_z, num_y, num_x, avg_x, avg_y, avg_z, max_x, max_y, max_z, min_x, min_y, min_z);
  
          fflush(stdout);
  
          if(Button_LEFT == 1)
  
          {
  
              return 0;
  
          }
      }
  }   
  
  double avg(double buffer[], int num_items)
  {
      double average = 0;
      int i = 0;
      for(i=0;i&lt;num_items;i++)
      {
          average = buffer[i] + average;
      }
  
      average = average/num_items;
      return average;
  }
  
  void maxmin(double array[], int num_items, double* max, double* min)
  {
      int i = 0;
      *max = array[0];
      *min = array[0];
      for(i=0;i&lt;num_items;i++)
      {
          if(array[i] &gt; *max)
          {
              *max = array[i];
          }
  
          else if(array[i] &lt; *min)
          {
              *min = array[i];
          }
  
      }
  }
  
  void updatebuffer(double buffer[], int length, double new_item)
  {
      int i = 0;
      for(i=0;i &lt; length;i++)
      {
          buffer[i] = buffer[i+1];
      }
      buffer[length-1] = new_item;
  }
  </code></pre>
  
  <p>Both of my '<code>scanf()</code>' statements are giving me format specifier warnings and an error for undeclared identifier. </p>
  
  <blockquote>
    <ul>
    <li>warning: format specifies type 'int *' but the argument has type
    '&lt;dependent type&gt;'</li>
    <li>error: use of undeclared identifier</li>
    </ul>
  </blockquote>
  
  <p>What is causing this to happen?</p>