title: C: Terminating the program by pressing a key
body: <p>In C, I normally use the <code>getch()</code> function to wait for a key to be pressed and then end the program, but recently I read that since it's not a standard function, it's bad programming practice to use it.</p>
  
  <p>So instead of the following:</p>
  
  <pre><code>int main() {
      dosomething();
      getch(); //wait for the user to see the results and press a key to end
      return 0;
  }
  </code></pre>
  
  <p>What should I do to replace the <code>getch</code> ?</p>