I've never coded in c before but have to for a class that I'm taking. I'm using miracle c as my compiler but am having a strange error when I try to execute a program. The program executes, but the command window instantly closes so I can't even tell if the program is working as it should. This seems like it should be a fairly simple problem to solve, but is really annoying!

thanks,
nick clark

Recommended Answers

All 5 Replies

It's not an error. Windows automatically closes console applications once they're finished. To pause the program before it quits (so you can view the console output), put getchar(); at the end of your program.

write getchar(); before return. That should pause until you press enter if no characters was left behind in the stdin.
If you can change compiler. Miracle C is broken. Look here for some suggestions

commented: Miracle C is nothing but trouble. +13
commented: The only Miracle is the people who actually pay to use it. +13

u can also getch() but it doesnot work in some compiler.

commented: So why recommend it? -2

u can also getch() but it doesnot work in some compiler.

Why do people insist on making bad suggestions, especially after a good suggestion has been made?

And if you read the Rules, they request you use the word you, not the letter u, so people that don't speak English well can understand your post.

Why do people insist on making bad suggestions, especially after a good suggestion has been made?

And if you read the Rules, they request you use the word you, not the letter u, so people that don't speak English well can understand your post.

thanx for suggestion

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.