title: Why can we insert more elements in an array than what it can hold
body: <p>In the code below, I insert 6 elements in the array.  The array size however is 5 and the for loop runs 7 times.  The code then inserts and print the 7 elements.</p>
  
  <p>It seems it doesn't matter what the size of the array is since I can apparently insert and print more elements.  If that's the case, then why even declare a size for the array?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  
  int main()
   {
     int index, block[5], number;
  
     printf("\nEnter number  of elements which you want to append :");
     scanf("%d", &amp;number);
     printf("\nEnter the values :");
     for (index = 0; index &lt;= number; index++)
     {
         scanf("%d", &amp;block[index]);
     }
     for (index = 0; index &lt;= number; index++)
     {
         printf("%d\t", block[index]);
     }
     return (0);
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Enter the values :1
  2
  3
  4
  5
  6
  7
  1   2   3   4   5   6   7
  </code></pre>