How can I get my program to stop terminating?
Ok, I'm realtively new to C programming, but I have a light background in Visual Basic, Java, and HTML.
I've been trying my hand at some very simple C programs, and I've run into something I'd like to change. I can get the programs to work just fine, but my problem is this: once they run through to completion, they simply end and the window closes. You can see my problem, because if the program specifies a certain output, I won't be able to read it, as it will quit immediately once it outputs the result.
Here's some code from the first program I made (it's VERY simple, bear with me):
Code:
#include <stdio.h>
int main()
{
printf("This is ass-easy.\n");
return 0;
}
So far, the only way I've been able to prevent this is by putting the line "scanf("%d");" at the end, and I know there is a better way than that to fix my problem. If there's a cleaner way to get the program to stay open once it's finished working until I close it myself, I'd really like to know how.