title: How differently are these two variables handled in memory
body: <p>I am learning about the way memory is modeled in C. I know that there are basically four different parts. Static memory, stack, heap and program memory. I know that when something is declared static, its lifetime (and not necessarily its visibility) is the entire program. So let's say I have written something like this:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void add();
  
  main(){
      int i;
      for (i=0; i&lt;6;++i){
          add();      
      }
      return 0;
  }
  
  void add(){
      static int x=5;
      x++;
      printf("The value of x is %d\n", x); 
  }
  </code></pre>
  
  <p>The program keeps track of the value of <code>x</code> till the last execution. If I write the program like this, I get pretty much the same result:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int x=5;
  
  add(int *num){
      (*num)++;
      printf("The value of x is %d\n", *num);
  }
  
  main(){
      int i;
      for (i=0; i&lt;6;++i){
          add(&amp;x);
      }
      return 0;
  }
  </code></pre>
  
  <p>I didn't use the <code>static</code> keyword, but because of its cope, the program keeps track of its value in successive executions of the <code>add()</code> function. I'd like to know if in both of these cases, the way <code>x</code> is handled in memory is the same. Is the second <code>x</code> also treated as static?</p>