C Language Tutorial

INTRODUCTION

What is C?

C is a procedural computer programming language which supports structured programming nature.

Developer of C

Dennis Ritchie

Where it was developed?

In the year 1972, C programming language was developed at Bell laboratories of AT&T (American Telephone & Telegraph), located in the USA.

Why C?

C language is recognized worldwide and it is used in a multitude of applications which includes advanced scientific systems and operating systems. Another important point is that C programming language is the mother language of all advanced computer languages.

How does C work?

The C compiler (it can be GCC, Clang, Visual C++ etc.) reads the C program and compiles into an object code. This language works by being translated to an executable code (.exe for Windows platform) by the compiler and linker. Finally, it becomes ready to run.

Advantages of C

Disadvantages of C


INSTALLATION

WINDOWS PLATFORM

Requirements

Steps of setting up

Well I’m assuming that you have a laptop or a computer right now Now you have to download a compiler. One thing you should know that we can run C programs by using C++ compiler also like g++ compiler etc. To prefer the specific procedure, we shall go with C compiler for now. You can download it from the given link.

image9

If you are in 32bit platform then go with the 32-bit option otherwise choose the 64 bit one.

After downloading you have to install it and opening this executable file you will see a window like below

image9

You have to move with Create because you are new to C 😊

image2

Now you have to choose the architecture version of the compiler depending on your system architecture. I’m in 64-bit so I’m going with second option if you are in 32-bit then go with the first one.

image3

Okay now you should give a place to your new wife (it’s virtual) 😊 so click Next > and select all the option of installation files. Make sure the Add PATH option is checked.

image4

Well now you have to connect your PC to the internet and the installation wizard will download it’s required files over the server.

image5

And you have successfully installed the GCC compiler. To check whether its installed or not just open your cmd (Command Prompt) and run the command gcc –-version.

image6

If you get a message like above where the version of your compiler is shown then just put a smile on your face 😊

Now you have got the ticket of your C programming journey but now you have to take your seat, right? Let’s get the text editor.

I’m preferring Sublime text editor, it’s free, easy to handle and has a nice interface. Through this link you can download Sublime Text.

Just install it and you are ready to go.

image7

It will look like this 😊

LINUX PLATFORM

Requirements

You don’t need to download anything on Linux because all the compilers are already installed on Linux operating system. Just we need to download our Sublime text editor to write code efficiently. To check the existence of compiler just open the terminal by pressing Ctrl + T or Ctrl + Alt + T (depends on your Linux Distro Type) and run the command.

image8

If you get a message like above on your terminal then it’s ok.
Now let’s install Sublime text on Linux. Just run the following commands on your terminal.

It will prompt you for your password. So, type the password and press Return. It will show OK on terminal.

Basically, it’s a process to ensure whether the apt is set up to communicate with the https sources.

This will add the repository of sublime text stable release so you can download it now through CLI (Command line interface)

It will update your source packages.

This will download approx. 34MB and after that you are ready to code in Linux.
You are all set.

MAC

Requirements

Like Linux, you don’t need to download any C compiler for MAC. It’s already installed. Just you need to download the text editor. We can run almost any program by using Xcode but to move with simplicity we shall be using Sublime text editor. Just go to the given link and download the .dmg file from the section OS X of the website.

That’s it you are all set on your MAC 😊