title: C sleep function not working
body: <p>When including the sleep function from <code>unistd.h</code> the program hangs indefinitely:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  
  int main()
  {
          int i;
          printf("0 ");
          for(i = 1; i &lt;20; ++i)
          {
              sleep(2);
              printf("%d ", i);
          }
          printf("\n");
  
          return 0;
  }
  </code></pre>
  
  <p>The rest runs fine when <code>sleep(2)</code> is commented out, any ideas?</p>