Compile and Run C Program
In this tutorial, we will be covering how to compile and run the program in C Language.
To compile and run a C language program, you need a C compiler. A compiler is software that is used to execute programs. To set up a C language compiler in your Computer/laptop, there are two ways:
-
Download a full-fledged IDE like Turbo C or Microsoft Visual C++, which comes along with a C language compiler.
-
Or, you use any text editor to edit the program files and download the C compiler separately.
Using an IDE - Turbo C
We will recommend you to use Turbo C IDE, the oldest IDE for c programming. It is freely available over the internet and is good for a beginner.
Step 1: Open turbo C IDE(Integrated Development Environment), click on File and then click on New

Step 2: Write a Hello World program that we created in the previous article.

Step 3: Click on compile or press Alt+f9 to compile the code.

Step 4: Click on Run or press Ctrl+f9 to run the code.

Step 5: Output

Without an IDE
If you do not wish to set up an IDE and prefer the old school way, then download the C compiler which is called gcc from the gcc website https://gcc.gnu.org/install/
Once you have downloaded and installed the gcc compiler, all you have to do it, open any text editor, copy and paste the C program code from the previous tutorial, and save it with the name hello.c
Open Command prompt or Terminal(if you use Ubuntu or Mac OS), and go to the directory where you have saved the hello.c program file.
Type the command gcc hello.c to compile the code. This will compile the code, and if there are no errors then it will produce an output file with name a.out(default name)
Now, to run the program, type in ./a.out and you will see Hello, World displayed on your screen.
$ gcc hello.c
$ ./a.out
Hello, World
Difference between Compile and Run
You must be thinking about why it is a 2 step process, first, we compile the code and then we run the code. So, the compilation is the process where the compiler checks whether the program is correct syntax-wise, and there are no errors in the syntax.
When we run a compiled program, then it actually executes the statements inside the main() function.
Frequently Asked Questions(FAQ)
Ques 1: What do you understand by the process of compilation?
It is basically a process where the compiler mainly checks whether the program is syntactically correct or not. If there is any mistake found in the syntax then it will throw the errors.
Ques 2: Name the keys used in Turbo c in order to compile the code.
ALT + F9 is used in turbo C in order to compile the code.
Conclusion
This tutorial was all about how to run and compile any C program using an IDE name Turbo C . We have also covered how it can be done without using any IDE.