title: Array index out of bound behavior
body: <p>Why does C/C++ differentiates in case of array index out of bound</p>
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      int a[10];
      a[3]=4;
      a[11]=3;//does not give segmentation fault
      a[25]=4;//does not give segmentation fault
      a[20000]=3; //gives segmentation fault
      return 0;
  }
  </code></pre>
  <p>I understand that it's trying to access memory allocated to process or thread in case of <code>a[11]</code> or <code>a[25]</code> and it's going out of stack bounds in case of <code>a[20000]</code>.</p>
  <p>Why doesn't compiler or linker give an error, aren't they aware of the array size? If not then how does <code>sizeof(a)</code> work correctly?</p>