I made my first "hello world" program and successfully compiled it, and when I open the .exe it clearly says what it's suppose to, but it just closes as soon as it opens. Here's the script I used:
So my question is, is there some kind of code I need to add to it to keep the program from closing, or is there another problem I'm not seeing?
1) open up cmd and launch the program from within the command
2) add getchar(); to the end of your program. This will cause the program to hang until you type a character (press a key), so:
The reason it does this is because it assumes you're in a persistent console.
You could also use: