Introduction to C Programming – Setup C Environment

This tutorial intends to give you a brief Introduction to C Programming. You’ll also know how to set up the C programming environment on your system quickly. We’ll provide steps to install CodeBlocks which is a cross-platform C/C++ programming IDE.

Usually, the beginners start coding using the Turbo C++ IDE, but we recommend to begin with the CodeBlocks. It is because that this IDE is free, feature-rich, and compatible with most of the modern operating systems such as Windows 7, Windows 10, Ubuntu 18, macOS Siera/Mojave, etc.

Introduction to C Programming

C is a general-purpose programming language. Dennis M. Ritchie created it in the year 1978. It is not a very “High” level language but can perform any operations required for making simple programs to complex software applications. It is not too difficult to comprehend hence is preferred by many.

One more thing to note is that C is a case-sensitive language. It means you should not capitalize letters unnecessarily. You should write a program as in the given format.

To write a program means writing a set of instructions that a computer can understand. We all know that a computer understands only computer language that is Binary language (containing only 0s and 1s). It cannot understand our human language like English. Nowadays it does with the help of Artificial Intelligence, but that is for some other day. Therefore, to make our set of instructions understandable to the computer, a programming language comes in handy.

Now to start writing C programs, we will need an IDE.

What is an Integrated Development Environment (IDE)?

An IDE is an environment that is used to write computer programs, to compile them, to run them and to debug them. It becomes easy to program on an IDE because you can easily find errors and rectify them. One such free and open-source IDE is CodeBlocks.

Now, we will see how to download and install CodeBlocks IDE for our Computer.

How to install CodeBlocks IDE?

Step 1: Search for CodeBlocks on Google and click on the first link in the results.

Introduction to C Programming - Search CodeBlocks

Step 2: Go to the DOWNLOADS section.

Introduction to C Programming - Download CodeBlocks

Step 3: Click on the “Download the binary release.”

Introduction to C Programming - Install CodeBlocks

Step 4: Select the codeblocks-(version)mingw-setup.exe.

Introduction to C Programming - Select CodeBlocks Binary

Step 5: Download and open the .exe file.

Introduction to C Programming - Download CodeBlocks Binary

Step 6: Follow the instructions on the screen. Do not change any settings and complete the installation.

Introduction to C Programming - Install CodeBlocks on Windows 10

Step 7: Launch CodeBlocks

Introduction to C Programming - Launch CodeBlocks

Step 8: Go to Settings->Compiler->Toolchain Executables and click on Auto Detect and make sure that the directory is something like this: C:\Program Files\CodeBlocks\MinGW.

Introduction to C Programming - Compiler Settings

Step 9: Now to start writing programs, go to File->New->Project->Empty Project and click GO. Give its name and location according to your preference and click on Next. Do not change any settings on the next page, click on Finish. Now if you do not see an empty file on the workspace go to File->New->Empty File. Follow instructions and finish the process. Now you should see a screen something like this.

Introduction to C Programming - Add Files to CodeBlocks Project

Now, we will see some tools that we need to get started.

1. To write a program, you shall first need to create a project. Go to File->New->Project. Select Empty Project. Give a filename and location and click OK.

2. Now, the project may need one or more files. As we are just beginning, we will create an empty file.

3. After writing the code, you can compile it and run it by using the upper green triangle in the toolbar.

4. You can choose to run either in the Debug or Release mode while executing a program.

Woo Hoo! You’ve completed the Introduction to the C programming language.