Monday, September 20, 2010

why we use getch() in main(), to get output?

 getch() is a function call : it reads in a single character and waits for the user to hit enter before reading the character. This line is included before the end of the main() because many compiler environments will open a new console window, run the program, and then close the window before you can see the output. This command keeps that window from closing because the program is not done yet because it waits for you to hit enter. Including that line gives us time to see the program run.

No comments:

Post a Comment