Q: I'm compiling some test programs on a windows-based system, and the windows containing my program's output are closing so quickly after my program calls exit that I can't see the output. How can I make it pause before closing?
A: After wondering why the author of your compiler's run-time system didn't take care of this for you, simply add the lines
printf("Hit RETURN to exit"\n");
fflush(stdout);
(void)getchar();
just before the end of your program.
(If you want to wait for any keystroke,
not just the RETURN key,
see question 19.1.)