Setting Up Development Environment

In order to test the C programs and code samples, we need to setup the C Compilers or Development Environment in our system. For creating C source file we can use any text editor, but to compile source code into compiled binary, we need an compiler. Now lets see some basic terminologies :

Compiler : A compiler is a computer program that transforms human-readable (programming language) source code into another computer language (binary) code. The compiler compiles the source codes into final executable programs. The most frequently used and free available compiler is the GNU C/C++ compiler. In this tutorial series we are going to use gcc compiler, but you can also use other compilers like x-code, Turbo C++ etc. to test the sample codes.

IDE ( Integrated Development Environment ) : An integrated development environment or IDE is a software suite that consolidates the basic tools for writing and test software and codes. Typically, an IDE contains a code editor, a compiler and a debugger that the programmer accesses through a single graphical user interface (GUI). There are various IDEs available for C language. For example Code Blocks, Microsoft Visual Studio, Dev C++ etc.

Now lets see the setup process of Development Environment in Different Operating Systems :

In Windows :

In windows we are going to use DevCPP IDE, it is open source and use gcc compiler to compile codes. First Download DevCPP from the below link :

Now follow the below instructions :

1. Run the downloaded file and wait for the extraction of the setup files.

2. Click on the OK button, then on the next window click on I Agree button.

Now click on Next and then Install button.

and wait until the installation process is complete, now after the completion of installation process, click on the finish button.

Now at first startup of DevC++, the below window shows up, at this window click Next button.

And on the next window click Next again and after that click on OK button.

Now the DevC++ IDE is started, so to start writing c programs go to File menu and click on File >> New >> Project... option, and at here choose Console Application and click on C Project radio button.

Now give the project name and click on OK button, then choose the location you want to save your code and click on save button, now we are ready to go. Now copy and paste the below code on the editor and click F9 button to compile the code.
#include <stdio.h>
#include <stdlib.h>

void main() {
  printf("Hello world, This is My First C Program.");

Now click on F10 button to run the compiled binary/executable file.

Some Shortcut keys on DevC++ are :

    F9     :    To Compile source code
    F10   :    To Run compiled executable/binary file
    F11   :    To both compile and run

You can also install Turbo C++ for compiling and testing the codes. First download Turbo C++ from below given links :

        32bit version   download link
        64bit version   download link

The installation process is given in following video :

In Linux/Unix Systems :

In Linux/Unix Based systems we can use text editors like gedit, leafpad etc. to create source file and for the compilation, we can use gcc compiler. Now to install gcc compiler on your Unix/Linux based machine, use the below command :
 sudo apt-get update

 sudo apt-get install build-essential
Now to compile the source code within gcc compiler use the below command :
 $ gcc <source_file_name>
Example :
 $ gcc test.c
Now the gcc compiler will create an executable file a.out. To run this file, just put the ./ in front of it and hit enter
$ ./a.out
And to create executable file with another name, use the below command :
 $ gcc <source_file_name> -o <output_file_name>
 $ gcc test.c -o test
Now the above command will create the executable with the name test. To run the file :
 $ ./test

Next Topic :