Learn C programming

Chapter 1: The computer, a powerful tool!

   

Tutorial presented by: The Ludovyc and Jérémie F. Bellanger (Jay)
The Ludovyc
Publication: February 16, 2014 
Last revision: March 9, 2025

   
    

      Foreword by Jay

   

   Here is a new tutorial, presented by The Ludovyc, which aims not only to teach you the basics of C programming, if you are a beginner, but also to improve your skills through numerous exercises and scenarios. This tutorial is therefore an excellent introduction to the SDL Big Tutorials, which will allow you to create the video game of your dreams! heart

   And so, without further ado, I'll give the floor to Ludovyc for his tutorial! smiley

   

      I- What is programming? 

   

    Computer programming is a process which consists of writing, using a language, called a " programming language ", a series of instructions forming a program which will then be executed by a calculation unit, otherwise called a " processor ", capable of reading it.

   

    

      II- But then, what is a programming language?

   

   A programming language is a language made of words (like all languages cheeky), but here those words are in fact instructions for the processor and their correct spelling is therefore essential. Indeed, if a human being is capable of correcting the language mistakes made by his interlocutor, this is not the case for the computer, which will crash at the first typing mistake. wink It will therefore be necessary to be vigilant and to avoid copy/paste at first, to familiarize yourself with this spelling. 

   This language is also subject to its own syntax: instructions must be written in a certain way, otherwise the compiler may not understand it. cheeky But it's the same in english: if you start mixing up the functions of the sentence, for example, it will no longer make sense, or you may even say the opposite of what you wanted to say. For example, by reversing the subject and object. The order is therefore also very important. wink

 

   There are now several levels of languages. In ascending order, we find:

- semi-electric language,
- machine language,
- low-level language,
- high-level language,
- and finally, interpreted language.

 

   The semi-electric language is composed of instructions which are in fact a logical sequence of Boolean gates made by the passage of an electric current in the transistors which make up the processor (we are therefore more at the electronic level wink- and do not worry about the barbaric word "Boolean", it actually comes from the name of the logician George Boole who invented the "Boolean algebra").

   Machine language, called " assembler ", is a binary language (formed by 0 or 1) capable of being read by a processor. When it is read, most of the time, each assembler instruction actually corresponds to several semi-electric instructions, which saves time when writing. The semi-electric language and the assembler can be different from one processor to another (depending on its architecture). It is the manufacturers who define them.

   A low-level language is a language whose instructions are (or group together instructions) in assembler. A high-level language, on the other hand, is a language whose instructions are (or group together instructions) either in assembler or in a low-level language. Thus, there is less need to write lines with a high-level language, because it already groups together many low-level instructions under a single high-level instruction. cool

 

   Both low-level and high-level languages ​​need to be compiled into assembly before they can be executed by the processor. Similarly, in assembly, if the program's instructions are not all written in binary, it will also need to be assembled before it can be executed.

   If addresses to memory are replaced by names at program writing time (because Hero is easier to remember than e.g. #02a58cc9 cheeky), a linker will need to be run when assembling or compiling the program to replace the names with their correct addresses.

 

   Finally, an interpreted language is not read directly by the processor but by a program (or a virtual machine) which will then be responsible for interpreting its instructions and executing them within it.

   Now, to give you an idea, the C language we are going to study here is a low-level language. To name a few, "X86 assembler" is a machine language, "Python" is an interpreted language, and "Java" can be both low-level, when it is read by a processor that can read Java bytecode, or interpreted when it is read through its virtual machine (yes, yes, you know, the Java program that you probably already have installed on your PC to run certain programs, which could not work without it wink).

   You will also hear about high-level languages ​​as languages ​​that take into account inheritance, the object concept (or OOP: Object-Oriented Programming), genericity, and which are more powerful, cleaner, that make coffee, that mow the lawn, ... No, I'm joking! laugh Because in fact to get into the depths of a computer and use it to its maximum potential, only low-level languages ​​and even more assembly languages ​​are capable of it because they work "as close as possible to the machine".

   That's it for this first little overview. It was a bit dense, it's true. But don't worry, all this will become clearer as you progress in programming! smiley

   See you soon for the next chapter!

 

    

This site uses cookies to enable you to log in. We do not store or sell any personal data. By continuing to use this website, you agree to their use. Thanks!