DEV Community

Cover image for Three reasons to learn C in 2019
mkdev.me for mkdev

Posted on • Edited on • Originally published at mkdev.me

Three reasons to learn C in 2019

Before we start I should warn you – I simply love programming.

Why should you learn C in 2019, if there’s a bunch of other languages, which are easier to work with and keep you from shooting yourself in the feet? There are definitely languages which are even more difficult than C. Esoteric languages, for instance, have plenty of boundaries and limitations and they are not the easiest to write in. But they are learnt by many people anyways, who even try to solve some problems with them. C can be learnt as an esoteric language too. It’s fairly minimalistic and doesn’t have many familiar things (e.g. you even have to create lists by yourself). As any other esoteric language it has some unfamiliar concepts like a manual memory management or a memory-mapped file.

So if you like programming and learning new languages, C works just as well as any other esoteric language and you can master it just for fun.

For me it was the main cause to learn it.

And in the long run there are some pleasant positive effects too.

If you know C, you know how everything works

The ones who use high-level languages, consider C a low-level language, when first getting into it. It means that you have to mess around with individual bytes, with memory, and also control if the function call and passing arguments are correct. In fact, it’s not quite like that, and one can program in C even without all those nuances. Except that comprehending all those details is closely related to learning the afore-mentioned language. The thing is that C does not conceal any of those details from the programmer. And understanding of them helps a lot with writing in C, but gives you virtually nothing, if you want to write in the high-level languages.

Come to think of it, such an understanding is might be beneficial in some fields, as well as the knowledge on how programs are actually run on real computers. Some say that you need to write in C in such fields. This is not entirely true. It’s more like you need know everything that you’ve discovered while learning C. And you can write in anything: in C, C++, Go, Rust, there’s a whole bunch of stuff for sure.

What is it all about?

About all the situations, when there are some requirements for the program itself, not only to the way it works. The program sometimes should meet the particular criteria, such as the speed, the size or some specific binary format for the exported function (if it is a library).

Nothing can beat C in speed

Nowadays it’s widely stated that a working hour of a programmer is more expensive than a memory upgrade or a high-powered CPU. But for me the size of a program and its speed are the things that make a difference. I hate it when the program wastes too much memory or works unreasonably slow. And I hate it even more, if this program is mine. While using C I have an opportunity to accommodate the need of an ideal program. How is it connected with the business goals? Well, I was lucky to find the job where it’s significant. But it’s also applicable to the embedded development, where every byte and every second count. For example, in IoT.

C can accelerate the programs written in other languages

But it’s a little bit tougher with the libraries. When there’s a need to make a connection between several languages, the requirements for the binary format emerge. And since the format is already defined, the compiler needs to hold in the specified format. But all the advanced languages compilers can even go further. It’s great when the compiler can be asked to generate the result in the desired format, but with C you can do that single-handedly. That’s why C is used to write different language extensions.

C is simple, so if you plan to extend some language in the future, it will allow you to create a needed interface. But it’s worth noting that you can have absolutely the same effect in C++, if you use extern "C". There are also some instruments that can generate desired code in C and this code will be used as a layer between the library and the language you plan to use in the future. If you use these instruments, you can skip learning C or understanding the library format. But it’s way easier with them.


This is an mkdev article written by Ilya Konovalov. You can hire Ilya to be your personal mentor.

Top comments (0)