Compile and Run C Program
First thing you need to understand is that computer (Machine) can only understand Machine language (that is 0’s and 1’s). In order to convert C program source code to Machine code, you first need to compile it. Compiler is one, which converts source code to Machine code. In simple terms you can understand that a compiler converts human readable code to a machine readable format code. But First of all you need to install and setup Turbo C compiler on your computer. Now let’s start step by step how to compile and run c program.
Download link for C Editor : Turbo C/C++
Steps to Compile and Run a C Program
Step 1: Locate the TC.exe file and open it. You will find it at location C:\TC\BIN\.
Step 2: File > New and then write your C program
Step 3: Save the program using F2 (OR file > Save), remember the extension should be “.c”. for example Hello.c
Step 4: Compile the program using Alt + F9 OR Compile > Compile
Step 5: Press Ctrl + F9 to Run (or select Run > Run in menu bar ) the C program.
Step 6: Alt+F5 to view the output of the program at the output screen.
One more thing is you can use any open source editor to run c programs and many plugins are there with editors that make your job more easy like suggestions, hints etc.
GCC compiler took the human readable format (*.c file) and converted into a machine code (*.exe for windows and just program for Mac and Linux).
- C program file (Source file) must save with .c extension.
- Compiler converts complete program at a time from high level language to low level language.
- Input to the compiler is .c file and output from the compiler is .exe file, but it also generates .obj file in this process.
- Compiler converts the file only if there are no errors in the source code.
- CPU places the result in User Screen window.
Go For First Program In C Language