How do I compile and execute a C program?

In Linux you can use the gcc [Gross C Compiler] compiler for compiling a C program. The file will be compiled and if no errors object file will be created, which can be executed by giving typing './a.out' in the current path. You can also specify a name to the output file. If you specify a name, after compilation a new file will be generated in the name you have specified, with a '.o' extention
For more information on gcc, type
'man gcc' or 'gcc --help' in the shell prompt.  


In Windows, you will need a compiler/builder like Microsoft Visual C++ Express or Dev-C++, both of which can be downloaded free of charge on the internet. Once you have this set up, open the project in the appropriate program (for help on this see the program's help files), and choose the Build option (or similar) from the menus at the top of the program's window. The Windows executable file (with file extension .exe) will most likely be in the same folder as the project provided there were no errors.

Double click it in Windows Explorer, and it will execute. If it's a command line program, the output may dissappear too quickly to be visible. In this case, press Windows+R to bring up the Run dialog. Type in 'cmd' (no quotes), and the Command Prompt should appear. navigate to the correct directory using 'CD ..' to go up a directory and 'CD [directoryname]' to go into a directory. From there, type the executable file's filename and hit Enter. The program should run.