C: Terminating the program by pressing a key
c
Solution
`getc(stdin);` is portable in this sense
Problem
In C, I normally use the `getch()` 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. So instead of the following: ``` int main() { dosomething(); getch(); //wait for the user to see the results and press a key to end return 0; } ``` What should I do to replace the `getch` ?