title: Signal and alarm function
body: <p>I require some assistance or advice in a C programming task that I received...
  The task is that with the <code>alarm(sec)</code> a signal <code>SIGALRM</code> needs to be called.
  I have to increase a long int number in 1 second and print out on the screen how many times the number was increased in that time. I suspect that it will have to go with the <code>alarm(1);</code> 
  I have the loop to increase the number ... bit have absolutely no idea on how to stop it after 1 second especially with the <code>signal(SIGALRM,xxx)</code>
  Shall I paste in the code that I have ?</p>
  
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;unistd.h&gt; 
  #include &lt;signal.h&gt; 
  
  int loop_function() { 
      int counter = 1; 
      long int n = 1; 
      while(n!=0) { 
          ++counter; 
          n++; 
          printf("%d: %d\n",counter,n); 
      } 
  } 
  
  int main() { 
     loop_function();
  }
  </code></pre>