Sunday, July 26, 2009

C Programs not running on turbo C, Please help.?

Even the programs from book "Let us C" is not running. Just black screen appears when run command is given and again comes back to the program.

C Programs not running on turbo C, Please help.?
I'm assuming they compile and link.





If you are running them from an IDE (a windows editor), what might be happening is a command line window is created, the program runs, then the window closes. This can happen quickly so that you don't see the program output.





What you can do is create your own command line window (in XP, Start | Programs | Accessories | Command Prompt). CD to your build directory and then run your program (there should be a .exe file that is created from your compiler). You should then see the output of your program, and your command line window will not go away.
Reply:I feel you are making a silly mistake (made by many!)...





Press ALT+F5 to view output window...





then LET US C will run fine...
Reply:Why are you using Turbo C? It is old. There is much better than that. Try DEV C++5.0 It is much more friendly %26amp; popular. It is free as well. Enjoy !!





http://www.bloodshed.net/devcpp.html
Reply:Check for semicolons (;) They are the pitfalls.





What would happen if you typed like this:


main();


or


for (i=0; i%26lt;n; i++);


{


........


........


}





There are many reasons. May be the first answer also.


I'm giving just another possibility.
Reply:this might happen when the program runs and finishes execution as a result the black screen appears %26amp; closes.





i think my friend "ff1100k" who has answered above has got the solution but it is very complicated. u may not be able to compile and run the program if u do not know the DOS commands for that.





also as "Seeker" has suggested ";" after main() i.e. main(); might also be the problem.





if both the above doesn't work and if u want to see the result or print some data from your program and look at it, then at the end of the program i.e. before closing the braces "}" of main() put a getchar().





if you do this, after finishing the execution the program will expect an input from you before closing the screen. this will give you time to look at the results. once you enter any key the program terminates and the black screen closes.





if this doesn't solve the problem get back to me, it may be a problem with compiler. we can find out the problem if u tell me what happens.
Reply:Just Press "F5" when it comes back to program it shows you the out put.

avender

No comments:

Post a Comment