A DEEP DIVE INTO C PROGRAMMING. (Part 1)
Tags: programming, career, beginners, c
Published: 2022-09-11 15:43:13


#A little History of the C language
 A little dive into the history of C would be a good place to start I presume. **Dennis Ritchie** is the name behind this magnificent language. The C programming language had it predecessor from B created by Ken Thompson. 'C' is more of an upgrade of B. It was founded in 1978 by both Brian Kerninghan and Dennis Ritchie. C is the programming language that was used to write **UNIX** developed by both Dennis Ritchie and Ken Thompson. Dennis Ritchie died in October 2011 having received many awards based on his inventions and creations. [Dennis Ritchie](https://en.wikipedia.org/wiki/Dennis_Ritchie).
    

> A journey of a thousand miles is started by taking the first step- Chinese Proverb.

Before we dive in into C programming we have to know what C as a language is and why it is important to learn C programming. C is considered a high-level programming language but compared to other programming languages such as Python, Javascript and Java, it is the lowest level programming language. "What high level and low level language is he talking about?" You probably must be asking yourself what the meaning of high and low level language by now. The highest level is the human language that we use to communicate especially English. The lowest level is the machine language or should I call it the computer language (binaries). This means that a high level programming language syntax is close to human language and can comfortably be read by human, the vice versa is true. This means that the C syntax can easily be understood by humans.

Too much of that already, but we can't begin before we know what type of language C is. C is a compiled language. This means that it's not possible to write a C program and run it straight away after saving it. You have to pass it through a compiler so that it can be executed by the machine. As you already know, C being a high-level programming language it is written in a language near human language that the machine, in this case, your computer can not understand. Thus, the written program must be converted to a language that the computer understands. That is where the compiler comes in. The source code passes through four main stages before it can be executed. That's a lot of stages I know. Am I the one who is going to do all that? Relax, the compiler does all the work for you. The stages are preprocesser, compiling, assembling and the linking. 

 1. **The preprocesser stage:** This is the stage where the required libraries defined in the header are assembled and made available to the source code. The extension of the source code at this level is **.c** .Then the source code goes to the compiler stage.

 2. **The Compiling stage:** The compiler compiles the source code plus all the libraries that have been assembled into another file called assembly file.

 3. **The assembly stage:** At this stage we have an assembly file. The compiler assembles the required function code and makes it available for the linker to link and make an executable file out of it. The assembled data is stored in an _object file_ with the extension **.obj** for windows and **.o** for unix users.

 4. **The linker:**After all the required function code is made available, it is now time for the linker to connect all of them plus the object file to make an executable file that will now run on the computer to perform the task intended. The linker will yield an executable file with the extension **.exe** for windows users and **a.out** for unix users. This is now the binary code.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rbu8de810r68g5cqx6d.png)

That's a lot to do isn't it? Well, that's less than blink of an eye to the computer. At this stage you know that you need a compiler if you are using a windows system but for Unix users, the **gcc compiler** or the **gnu compiler** comes already installed in the machine. All you need to do is run the `gcc` command.(We'll look at it later.)

`gcc file_name.c -o new_filename`

Now that you know what happens to your program after you write it, it is time to get our hands dirty. Look out for my next article where we will be writing our first code and learning more about the C syntax.