title: Why does the while loop stop at 0 in this code?
body: <pre><code>#include &lt;stdio.h&gt;
  
  /* function declaration */
  void func(void);
  
  static int count = 5; /* global variable */
  
  main() {
  
     while(count--) {
    func();
  }
  
  return 0;
  }
  
  /* function definition */
  void func( void ) {
  
  static int i = 5; /* local static variable */
  i++;
  
  printf("i is %d and count is %d\n", i, count);
  }
  </code></pre>
  
  <p>I am looking at the while loop and there is no reason as to why it should stop at 0 however when count reaches 0, it stops. I try to set count as 0, and use -- and it went to -1 so there's no reason why this should stop at 0 from what I can see.</p>