title: Shifting array elements leaves last elements blank
body: <p>i'm currently working on a project where I'm averaging the output of the last 10 to 20 measurements. to do this I'm saving the last 10 values in an array. right shifting the elements to update the data.  </p>
  
  <p>The code that I'm using to shift the values:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>void shiftvals() {
      memmove(&amp;val[1], &amp;val[0], (sizeof(val) / sizeof(val[0]))-1);
      for (unsigned int i = 0; i &lt; (sizeof(val) / sizeof(val[0])); i++)
      {
          Serial.print(val[i]);
          Serial.print(",");
      }
      Serial.println();
  }
  </code></pre>
  
  <p>The code calling the function:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#define ARR_SIZE 10
  uint16_t val[ARR_SIZE];
  
  void loop(){
      Serial.print("Size of the array:\t");
      Serial.println(sizeof(val) / sizeof(val[0]));
  
      shiftvals();
  
      val[0] = (analogRead(A0));
  }
  </code></pre>
  
  <p>Now the problem is that the last few outputs will always be 0, even though the array fills up nicely. When I increase the size of the array the amount of empty spaces also increase.</p>
  
  <p>Output:</p>
  
  <pre><code>396,396,381,462,503,195,0,0,0,0,
  472,472,396,381,462,247,0,0,0,0,
  495,495,472,396,381,206,0,0,0,0,
  435,435,495,472,396,125,0,0,0,0,
  </code></pre>
  
  <p>I'm seriously confused, what am I doing wrong in the <code>memmove</code>?</p>