Why does this C code magically print "a[2] = 98"? : <pre><code>#include &lt;stdio.h&gt;

int main(void){
  int n;
  int a[5];
  int *p;

  a[2] = 1024;
  p = &amp;n;

 /* adding any of these lines makes code to print "a[2] = 98" at output */
  p[5] = 98; //OR *(p + 5) = 98;

  printf("a[2] = %d\n", a[2]); //Prints a[2] = 98
  return (0);
}
</code></pre>

<p>I don't understand why this C code magically prints "a[2] = 98". Though, this is what I want but I want to understand it.</p>
