Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent the console (application file) from closing itself immediately after running in windows? [closed]

Tags:

c

After I compile my program and run the executable, it closes instantaneously. I barely see my output. How do I prevent this?

like image 873
Ozgur Aydogmus Avatar asked Mar 23 '16 21:03

Ozgur Aydogmus


1 Answers

The following two lines will print the message "Press ENTER key to Continue" and then pause execution waiting for the enter key. I hope this helps.

printf("Press ENTER key to Continue\n");  
getchar(); 
like image 106
conrad gardner Avatar answered Sep 17 '22 17:09

conrad gardner