title: Use of exit() function
body: <p>I want to know how and when can I use the <code>exit()</code> function like the program in my book:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void main()
  {
      int goals;
      printf("enter number of goals scored");
      scanf("%d",&amp;goals);
  
      if(goals&lt;=5)
          goto sos;
      else
      {
          printf("hehe");
          exit( );
      }
      sos:
      printf("to err is human");
  }
  </code></pre>
  
  <p>When I run it, it shows ERROR: <em>call to undefined function exit()</em>.</p>
  
  <p>Also, I want to know how I can create an option to close the window in which the program runs? For example, I made a menu-driven program which had several options and one of them was <em>"exit the menu"</em>. How can I make this exit the program (i.e. close the window)?</p>