I want to run a C program in DOS prompt. Is it possible?
If You mean MS-DOS mode in winXP for example:
start->run
type: cmd
goto your program path
cd C:\Your\program\path
type
yourprogram.exe
thats it.
Open the prompt, and just type in the location of the exe, e.g. c:\MyProg\Prog.exe
You can run a compiled c program (i.e. one that has been compiled to an .exe file) at the DOS prompt (by simply running the .exe as other answers suggest). You cannot directly run a .c file at the DOS prompt.
Yes, it is possible. You can install TCC which allows you to put
#!/usr/local/bin/tcc -run
as the first line of your source code. This is a compiler that will compile and run directly from source code.
Another option is to use CINT which is a C interpreter. This will allow you to run C programs from the CMD
prompt in Windows, which is what most people still call the "DOS" prompt.
First you need to download Dev Cpp compiler. After downloading install it. I assume you are installed C:\ drive. Now create file called filename.bat extension. write text as follows... set path=C:\Dev-Cpp\bin;C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2
now open cmd....
go to save location of filename.bat and run it.
filename.bat
after setting path go where is saved file... for example c:\save\
Now compile your C file using gcc compiler...
gcc filename.c OR filename.cpp
and execute .exe file...
a.exe
Have fun...