Why should every programmer learn C?

C will make you understand exactly how do computers work

Dmitry Guzeev
5 min readJan 4, 2018

--

Learning C will teach you the underlying principles of the computer architecture, such as, for example, pointers, which are, indeed, fundamental for everyone who wants to create their own programs.

C will make you feel more confident in what you type into your files in every programming language just because you will know how does it work on the lowest level.

Let me draw an analogy: You can compose your diet using someone experienced, but, however, after you will receive your diet plan, you won’t know anything about the reasons certain things were chosen.

Now, if something doesn’t work (your fat doesn’t go away, you aren’t gaining muscle, etc.) you just wouldn’t know why does it happen. You won’t be able to fix it by yourself as you don’t know how does it work.

But, however, if you have composed your diet by yourself, and, on the path, learned some things about dietology, health, and human body mechanisms, if any kind of a problem arises, you will, with 90% chance, know why did it happen, and, so, you will be able to fix it.

The same thing for programming: You could choose between “using an expert” each time you need to do something (using highly-abstracted programming language), or you could learn how does it work on a fundamental level. Knowing how do things work will also let you fix problems easily.

Advantages of learning C first

Now, I don’t say that C is, necessary, the first thing you should learn when becoming a programmer. I just want to say that learning C is, in itself, very useful for every programmer.

However, I do think there are advantages to learning C first over more high-level programming languages (like C++ and Python). When you work with languages like Java, C#, and even Python, you immediately start moving away from learning the fundamentals of a programming language and you start learning associated libraries and frameworks. But with C you get a few library calls, you stay focused on the semantics of the language longer, and C often forces you to think harder and deeper about what’s happening under the hood.

C is a middle-level PL (not a low-level PL, as most of the uninformed people say). When people talk about it you’ll hear phrases like “coding to the metal,” or “coding close to the wire.” C is the language of compilers, interpreters, editors, operating systems and embedded programming. When you learn to program in C you almost have to gain an understanding of how programs execute. You know what things like register, stack, heap, and memory mapped IO mean.

I was truly amazed when I’ve first learned how function calls work on the lowest level. And this is not the only thing I’ve got truly amazed at when I was learning C, however.

Simplicity and speed

C is simple. Now, I’m saying this only from the programming language standpoint: There are very few keywords and syntactical structures one should learn in order to write professional C. I’m not saying that you could learn C as a 6-year old kid, — I’m not talking about the overall simplicity: there are things that are hard, but those things are not related to the language directly — they are fundamental, as I’ve already mentioned.

Programs written in C are also wicked fast and efficient. So, you always know what to do when your program doesn’t run fast enough :)

Not only C programs by itself are efficient, but the language syntax itself teaches you how to write efficient and fast code: C has raw pointers, static memory concept and much more. You will learn why it is better to pass big objects through the reference to other functions than by value.

The only thing that will teach you to write efficient code any better is a low-level language, but, however, I don’t recommend you learning modern’s world processor ASM mnemonics.

Clean code

Learning C will also teach you to write clean procedural code in an imperative paradigm.

C is also not an OOP language so you wouldn’t be distracted by the things like inheritance and polymorphism when writing C code. Now, I don’t want to say that those things are bad or something like that. They just do really make your code more complicated and “heavy”, which is not a good thing.

From my personal experience, writing C code is much easier than writing C++.

Programming discipline

C also happens to be demanding, fastidious, finicky and sometimes downright cryptic. You can easily write hard-to-read, difficult to maintain code in C. But, you don’t have to. Learning to write maintainable code in C will require (and hopefully instill) coding discipline.

And yes, not all languages allow you to learn coding discipline. C is mostly unique in that sense. In the majority of modern programming languages fixing syntax errors can border on the trivial. For instance, Ada’s compiler error messages are so good it might as well have just fixed the code for you. But, in C, you will be scared of putting an additional semicolon at the end of the line (as it could just leave you with hours of hard debugging for some kind of unknown problem). So, your brain will learn to look at every actual character you are typing into your project’s files.

Embedded programming

Yes, I will mention this.

Programming is fun: It is very cool to watch how the computer does exactly what you’ve told it to do. But, however, we weren’t born with the sense of feeling how electricity flows through the wires: we don’t have such a feeling, and, so, it is always funnier to see how the robot moves his leg because you’ve programmed a circuit which runs that entire robot.

C is very good for embedded programming. As I’ve already said, C is fast and it has access to the low-level computer things with a very little abstraction, — this is what makes it good for embedded programming.

Popularity

As I’ve mentioned earlier, C is good for embedded programming, and, so, it is popular in that field.

I also want to say that C is no-less popular in other fields too. Just look at the graphs of programming language rankings for the 2017 year.

IEEE Spectrum

TIOBE Index

Just look, C is on the second place! And, as it is seen from the second picture, popularity of C still increases. In fact, it’s popularity increase in 2017 is much higher than of all other programming languages. This is fascinating!

Isn’t C++ a better thing to learn?

Well, that’s a good question.

C is a subset of C++, and, so, you could always continue with C++ after learning C, and, also, I want to say that, for learning C++, learning C is a requirement.

Last words

Thanks for reading! Let me know your thoughts on this topic in the comments below.

--

--