C: Console window disappears.

Here is something I want to share with you.

If you program in C, with some console windows, the window might disappear after execution.

If you want to prevent that just add this line in front of the return 0; line in your main(void) 🙂

while(getchar() != '\n');

getchar() is defined in stdio.h.

What it basically does is wait for an end of line input (return key). Just press that and the window closes, end of the program!

Or you can try this (I read this in the comments, thanks!):