Introduction To C Programming Language

Introduction To C Programming Language

Hello There, Welcome to Think & Free. Here is the brand new series of Express Learning Programming. In this series, I’m going to talk about the GNU C Programming language from the basics to advanced programming concepts. Here you know this is the first lesson which is Introduction to C Programming Language. So before going to the deep programming concepts I need to make sure anyone can understand programming from 0 to hero with this lesson. I know learning a new skill is a little bit harder from the beginning so don’t worry about that I’ll make this series for both people who already know about programming concepts and those who don’t know about any programming concept that is brand new to computer programming.

So I think it’s enough for the huge introduction to this series, So let’s begin with the first chapter of our express learning tutorial series.

What is computer Programming?

Well here is the main idea about why we need to learn programming language and what is the exact meaning of Computer programming.

There are many explanations and ideas about this but here is the simple idea about this, Computer programming, also known as coding is actually a sequence of machine instruction sets. These sets of instructions are called computer programs. When we are writing these instructions we call Computer programming or coding.

There are so many programming languages there and I know you get stuck with now “What mean programming languages”? Don’t panic it’s a simple idea of the language we used to write those machine instruction sets.

But there is a huge issue machines can’t able to read or understand human languages directly. They only understand boolean values like 1 and 0. 1 means power on 0 means off. For both easy-to-program and conversion human instructions into these boolean values instructions for machines in late 1947 Assembly language will come into the world. It’s the first programming language. It’s a really huge innovation in those days but as always it also has a downside.

Assembly language is a symbolic representation for boolean value machine instructions, So the one main downside is when using assembly language we need to rewrite their instructions again and again for separate processors (Because of the architecture difference from processor to processor). Here the high-level programming languages appear.

I know you have a question what was the world’s first high-level programming language? It’s the FORTRAN language, created in 1957 by an American computer scientist Mr John Backus.

Birth of the C programming Language

After a few ages passed with the founding of some new programming languages like Cobol, in the year 1970 solo researchers and many huge tech industries like IBM, and BELL LABS, are working on building their operating systems for their latest computer devices. Languages like Cobol, B, and Assembly are not good for building efficient operating systems because of their programming structure. Here is the new programming language needed for the world. One of the Computer Scientists from Bell Labs created the Legendary C programming language in 1970. He works for Bell Labs and he is the Mr. Dennis Ritchie.

The C programming language was actually created for the build UNIX Operating system. So here is the birth story of The Mother of all programming languages which is the C programming language. I hope now everyone has an idea about how it was created and the history behind the C Language.

Since the release of the C programming language, it has come with many standards, I think you have already heard about some of the standards which are ANSI C, and ISO C, and there is a newer revision (C23) there and it actually in the not-released status yet. However, according to the Wikipedia page about C Programming Language, there is a total of 6 C Standards released (including C23).

What is the GNU C Programming Language?

The GNU C Programming Language, GNU is a C Library set that was created with including some core API and function sets for GNU Systems and GNU Linux systems. GNU Library is actually built under the ISO C standards and it’s now over 30 years old Project.

I’m not going to mention every detail about this, As an Introduction to C Programming language lesson I think it’s enough for the basics. if you want more details about this, please follow the GNU C Library Official website For more details.

Here we talked about lots of history regarding the C programming language, But Now let’s back to the main point. So what exactly is C programming language? Now we know history but you don’t know what type of language it is. C is a general-purpose, compiled, and procedural programming language. If you don’t have any idea about this don’t think much about it I’ll explain it later with the series.

So here is the journey started with learning the Mother of programming languages, C programming language. Now it’s time to create our first C program, But Here we encountered some problems, Where is the starting point to begin our programming journey? Let’s see first how to set up our environment to create our very first computer program using C.

Setting up your C programming environment

As I noticed in the introduction of this lesson, In High-level programming languages we need a special kind of computer software to convert our human-readable machine instructions to system-readable machine instructions. We called it a Compiler program, These compilers do a little complex work when it comes to the compilation and execution process, but at the beginning, I do not think it’s required to understand everything about compilers before starting to create a program in c, So I think that’s enough to talk about compilers.

So here is a simple and understandable way of explaining about compilation process, A Compiler is a computer program which used to convert human-readable programming instructions into machine codes, These machine codes can be directly executed.

I’m not going to very deep with these topics because this lesson is only an Introduction to C Programming Language. With the latter, I’ll make another in-depth lesson about how it’s actually working. Also If you need to learn more about compilers, please follow these resources as well,

Now you know we need a compiler to set up on our computer before start writing programs. With this lesson series, I preferred used to GNU GCC Compiler Collection. It’s actually a collection of compilers for multiple languages like C, C++, Objective-C, Fortran, Ada, Go, and D languages. It’s actually a completely free open-source project. Let’s move on with the GNU GCC Compiler.

Install GCC On Linux

If you are using a Linux System as your Operating System, follow your system package manager to install the latest version of the GCC Compiler. Or Follow the instructions in the GNU GCC Official installation document for example, Let’s see,

How to install gcc on Ubuntu distributions

First of all update the Ubuntu package repository using the update command.

sudo apt update

Now you need to install the build-essentials package because gcc comes with this package.

sudo apt install build-essential

How to install gcc on CentOS

Like in the Ubuntu, First of all, we should update the repository list.

yum -y update

Let’s install the GCC, using yum package manager

yum -y install gcc

If you think you’ve already installed gcc on your system or you need to verify whether the GCC installation is completed or not, you can use gcc with –version, If you have installed it correctly it will provide the version info related to the currently installed gcc version.

How to install GCC on Windows

When it comes to Windows systems process is a little bit different. There are a few options for doing that, and I’ll show you how to do it via using MinGW, MinGW is actually a software development environment developed for Windows environments and It comes with various libraries, compilers, and packages including GCC compiler collection.

Here I created separate lessons for the installation and configuration of GCC on your Windows system please follow these two lessons to install GCC on your system and configure it correctly.

How to install GCC on MacOS

Mac users can get a copy of the GNU GCC Compiler source code and they can manually build a binary and install it. Another way is Mac users can use the homebrew package manager to install GCC on their Mac system. The command is given below.

brew install gcc

Using brew is the easiest way to do that, So after that let’s move on with the lesson. Everything set’s ok for start programming with C programming language and create your very first own program with C.

Now you need to get a text editor to write your C source codes. There are hundreds of source code editors out there and you can use whatever you like to use, But I prefer to use an editor like Microsoft Visual Studio Code editor, Sublime Text Editor, or NotePad++.

PROGRAM STRUCTURE/SYNTAX

This picture gives the basic structure of a C program. In the first line, I’m starting with /*. It’s actually the starting of a multiline comment in C language. When you put /* it means after you type anything it will ignored by the compiler when it goes to the program compilation process. After I write some of the metadata related to this program in the line number 5 I ended that line with */ which indicates the end of the multiline comment in C.

#include <stdio.h>“, We can see a Header file including statements or including the preprocessor command header section. “#include” is used to, include a standard input and output c header file into the program. In future lessons, I will explain everything about these headers.

int main() is the entry point of every C program. It is the main function of the C program. All functions must call on this main function. after creating the main function, the main function will start with “{” and end with “}“. we must input all statements in this block.

In the main function first, we can see “print("Hello, World\n");printf is a function that comes with a studio.h header which is the basic idea we use to print texts in C program language. \n is a special character that notifies the compiler to end this line and do the next execution with a new line. This is also called a newline character in programming.

return 0; this is another main part of a C program return statement that will indicate the program or returning value or end state type. Don’t think about 0 yet. Just get the basic idea of how the C program structure works.

This is the main structure of the C Program.

End of the Lesson

Here we come to the end of the Introduction to C Programming Language Lesson. I hope you’ll get a basic idea about C program language and the story behind how it was born. So let’s keep practicing and researching learning is all about research and understanding your own.

Let’s meet with another brand new lesson with our Express Learning Programming lesson series.

CATEGORIES
TAGS
Share This

COMMENTS

Wordpress (6)
  • comment-avatar
    Deadshot 5 years

    Good Web site

  • comment-avatar
    Madusha Chathuranga 5 years

    Good article

  • comment-avatar
    Kaluaiya 5 years

    Congratulations

  • comment-avatar
    Kaluaiya 5 years

    Good

  • comment-avatar

    […] This is another episode of Express Learning Programming with GNU C Programming Language. In the previous lesson, we talked about all the basic concepts and other basic things about the GNU C Programming […]

  • Disqus (0 )