The C Language

Despite all these programming languages available we will focus on only one of them: the C. Before we talk about the characteristics of this language and the choices that lead us to study it in this course, let’s make a little history.

The History of the C

The C language was born in the early 1970s in the laboratories of the company AT&T in the United States. Its designer, Dennis MacAlistair Ritchie, wanted to improve an existing language, the B, in order to add new features to it. By 1973, the C was practically developed and began to be distributed the following year. Its success was such with computer scientists that in 1989, ANSI, and then in 1990, ISO, decided to standardize it, that is to say to establish international and official rules for this language. Currently, there are four standards: ANSI C89 or ISO C90, ISO C99, ISO C11 and ISO C18.

Why Learn C?

That’s a very good question.

After all, given that there are so many different languages, it is legitimate to ask why choosing the C in particular? There are several reasons for this.

  • Its popularity: C is one of the most widely used programming languages. Since then, a large community has been built around its use, so you will usually always find a person to help you as well as many courses, articles and tickets about it. Another consequence of this popularity is that many programs and libraries have been written in this language and therefore constitute an abundant wealth of codes from which you can draw.
  • Its minimalism: the C was built as a simple and minimalist language, especially in order to facilitate the development of compilers (even today, when new processor architectures appear, the C language is often the first usable language after the Assembler). This minimalism results in a reduced number of concepts and/or abstractions that also allow us to go around the language relatively quickly.
  • Its performance: C minimalism allows compilers to generally produce high-performance executables with a low memory footprint (which is especially valuable when the speed of execution is crucial and/or the amount of memory very limited).
  • Portability: In general, a C-developed program can work on a large number of different machines without the code having to be changed, the only condition being to have a compiler for each type of machine. However, because the development of C compilers is relatively simple, there are a large number of them for a large number of architectures, making C a portable language (from machine to machine).

These are just a few reasons, but they are to our liking sufficient to justify learning this language. Of course, the C also has its share of defects. One example is the tolerance of dangerous behaviours, which makes C require rigour in order not to fall into certain “traps”, a smaller number of concepts (sometimes a disadvantage, because one is then obliged to recode certain mechanisms that exist natively in other languages), etc. Moreover, if your goal is to quickly develop fun programs, know that the C is not suitable for this and that we advise you, in this case, to turn to other languages, such as Python or Ruby.

The C also has a feature that is both an advantage and a defect: it is a so-called “low level” language. This means that it allows you to program by being “close to your machine”, that is, without hiding too much of its inner workings. This property is double-edged: on the one hand it makes learning more difficult and increases the risk of errors or dangerous behaviors, but on the other it leaves you with a great freedom of action and allows you to learn more about how your machine works. This notion of “low level” is also to oppose the so-called “high level” languages that allow to program without a number of things. Development is made easier and faster, but in return, many internal mechanisms are hidden and not accessible to the programmer. However, these high- and low-level notions need to be nuanced, as they depend on the language used and the programmer’s point of view (for example, compared to machine language, C is a high-level language).

A quick note to finish: maybe you’ve heard of the C? It is a programming language that was invented in the 1980s by Bjarne Stroustrup, a colleague of Dennis Ritchie, who wanted to add elements to the C. Although it was very close to the C at the time of its creation, the C is today a very different language from the C and has almost no relation to it (if not a certain proximity at the level of a part of its syntax). This is even more true when it comes to how to program and reason that are radically different.

Do not believe, however, as their name or date of creation may suggest, that there is one language better than the other, they are simply different. If your goal is to learn C, we encourage you to do so. In fact, contrary to what is often said or read, there is no need to know the C to learn the C.

The rules

As noted above, C is a language that has been standardized three times. These standards serve as a reference for all programmers and help them whenever they have a doubt or a language-related question. Of course, they are not perfect and do not answer all the questions, but they remain the reference for any programmer.

These standards are also essential for compilers. Indeed, the compliance of these standards by the various compilers allows that there are no differences in interpretation of the same code. Finally, these standards are the equivalent of our spelling, grammar and conjugation rules. Imagine if everyone wrote or conjugated as they pleased, it would be quite a mess…