title: local variable initialized to zero in C
body: <p>I thought that the local variable in C is not initialized.  But when I compiled this code with gcc.</p>
  
  <pre><code>void f() {
      static int s;
      int n;
  
      printf("static s = %d\n", s++);
      printf("local  n = %d\n", n++);
  
      f();
  }
  
  main() {
      f();
  }
  </code></pre>
  
  <p>And run this code, the partial result is:</p>
  
  <pre><code>static s = 0
  local  n = 0
  static s = 1
  local  n = 0
  static s = 2
  local  n = 0
  static s = 3
  local  n = 0
  static s = 4
  local  n = 0
  static s = 5
  local  n = 0
  ...
  static s = 261974
  local  n = 0
  static s = 261975
  local  n = 0
  static s = 261976
  local  n = 0
  static s = 261977
  local  n = 0
  static s = 261978
  local  n = 0
  static s = 261979
  local  n = 0
  static s = 261980
  local  n = 0
  static s = 261981
  local  n = 0
  Segmentation fault: 11
  </code></pre>
  
  <p>Could anyone please explain this?  Or refer to a standard reference that C won't init local vars?</p>