title: About pointers and segmentation fault
body: <p>So , i have this code :</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      char *p;
      int var = -1;
      int i;
  
      /* Printing all memory we can read */
      p = (char *)&amp;var;
      /* No stopping condition. The OS will stop us */
      for (i = 0;; i++)
      {
          printf(&quot;(%i) %i\n&quot;, i, p[i]);
          /*
           * The next statement also tries to write a zero
           * starting from &amp;var. Try to uncomment and explain ...
           */
          //p[i] = 0;
      }
  }
  </code></pre>
  <p>in this way it goes in segmentation fault as it supposed to be , output :</p>
  <pre><code>..................
  (6556) 108
  (6557) 116
  ..................
  (6582) 0
  (6583) 0
  Segmentation fault
  </code></pre>
  <p>Uncommenting this line of code above there : <code>p[i] = 0;</code></p>
  <p>it doesn't go in segmentation fault and the output is this :</p>
  <pre><code>..........
  (1) 0
  (2) 0
  (3) 0
  (4) 4
  (1) 0
  (2) 0
  (3) 0
  (4) 4
  (1) 0
  (2) 0
  (3) 0
  (4) 4
  (1) 0
  ^C
  i have to interrupt it
  </code></pre>
  <p>Can't understand why this happens , and looks like i doesn't increase</p>