Antonin Hérault
Antonin Hérault

Follow

Antonin Hérault

Follow

Introduction to the C language (1)

Antonin Hérault's photo
Antonin Hérault
·Jul 10, 2022·

3 min read

Play this article

Table of contents

  • Discover your new best friend
  • Hello World !
  • Compiler installation
  • Common confusions

Welcome to the C course for beginners and advanced programmers ! This course is going to be as complete as possible, with tutorials, some exercises and a long trip to explore the C standard library.

If you want to give any review or ask for things to be added to this course, don't hesitate to post a comment under the posts of this course.

Discover your new best friend

The C programming language was created in the 1970s by Dennis Ritchie.

It's the successor of the B language. Got it ? We walked through the Latin alphabet letters until we finally made a good language for everyone. Then, derived languages born like C++.

Does the D language exist ?

Yes it exists. It got the 28th rank on the TIOBE Index on July 2022, when C got the 2nd rank. It's not common to use D. If you want to learn a more advanced language than C but with a very similar syntax, start to learn C++.

C has influenced and is still influencing a lot of programming languages (PHP, Perl, Objective-C, Java, and more...)

It uses an imperative paradigm, but can be multi-paradigm.

Hello World !

This example shows how to make your first "Hello World" with the C language :

#include <stdio.h>

int main(void) {
    printf("Hello world!\n");
    return 0;
}

What ??? But, how to make it working ?

Here we are. You have to install a compiler to transform the C code into a binary file that could be executed on your system. In this tutorial, we will use the GNU C Compiler (GCC) 1 but it exists other C compilers like Clang.

Compiler installation

As stated above, we use "gcc" for this tutorial. Try to see if it's already on your computer by typing gcc -v in your terminal command line.

We also have to install the "make" software that will be discovered in another post of this course.

  • Ubuntu : sudo apt update && sudo apt install build-essential
  • Fedora : sudo dnf install gcc make
  • Arch : sudo pacman -S gcc make

We will run our "Hello world" script in the next post.

Common confusions

"C" should not be confused with "C#" or "C++".

You may have seen the notation "C/C++" somewhere on the Internet. But this is a misuse that confuses the two languages into one thing.

Actually, C++ is derived from the C language, but today C++ is very different from C. Just because you know C doesn't mean you are a C++ programmer and vice versa.


  1. I wrote that "GCC" was standing for "GNU C Compiler" to make the name easily understandable. But today it's called "GNU Compiler Collection" because it includes other languages, it's not only a C compiler.

 
Share this