Back to the past – shortly about C

Day by day, we witness some programming languages becoming obsolete. Generally, these are the languages that have been used for a while, like twenty years or even more. However, there is one exception to this rule. Although many coders have never written a single line of code in COBOL or FORTRAN, every computer science student has to deal with C language at some point in their studies. You may think that it’s not worth learning it. Well, that’s only partially true, because even though it’s hard to find a job in C, learning it can be helpful for you to understand more in programming. Want to know why? Let me explain it.

If you are just a beginner at coding, C can be one of the best choices among the other programming languages. Why? It’s one of the most basic languages that exist. You can check that many different universities all around the globe teach students of the first semester how to program in C. Although, as I mentioned in the article titled "how to step into programming?”, you'll struggle to find a job in C, it’s good to start with it.

The other reason to know the basics of C is its influence on nowadays programming world. Many languages inherit from C, including C++, C# or Objective-C. Also, they used C for building Java, PHP, Python, and many other coding languages. You don’t believe me? Check this out on the C language Wikipedia page - you’ll see it’s not a fairytale.

You may say now: „Ok, but if it’s that old, how can C be appropriate for starting learning to code?”. The answer is simple – C support hasn’t been retarded yet. The newest stable version was released in 2018. Moreover, in this year (2021), a testing release of a new update of C language saw the daylight. That’s the proof that C is not dead yet – and it won’t be for a while.

One of the things that the beginners ask is: „Why are there so many semicolons?”. Well, it’s not only the C language feature but also the other ones. That’s also a good reason why choosing C as your first programming language is a good choice – its syntax is the most basic one you can ever imagine. With C, you’ll get used to using mentioned semicolons, but also basic instructions like if-else, switch statement and many others. Additionally, you can poorly find some advanced stuff. For example, there is no such thing as a vector in the C language. Hence, if you want to use it in C, you need to build it from scratch.

You may be irritated now. If the inventors of C haven’t implemented even that basic structure in C, why should you learn such a crap? Well, firstly, C is not crap, trust me. Secondly, it’ll broaden your knowledge when it comes to non-implemented topics. I’m sure if you used C++, you dealt at some point with vectors. But tell me, have you ever written a vector-like structure from scratch? Do you even know how does it work? As you can see, C can improve your knowledge in this context exactly because it's extremely minimalistic.

When you take a closer look at comparing C with other languages, you’ll notice that it’s incredibly fast. But why is that happening? What’s the key to one of the fastest code execution? Why Python, Java and other languages are visibly slower than C?

There is a couple of answers. One of them is that C is close to the Assembly. For those of you who don’t have a clue of what it is, Assembly Code is a program that is directly compiled into the machine code. Sometimes, it’s also called Assembler. As you can see, these similarities give C a great advantage – it’s being compiled to the Assembly at a speed that will be unreachable for any high-level language.

The other reason C is incredibly fast is that it’s a skeleton of a programming language compared to Python, Java or any other advanced language. The difference between them is like a difference between the American and Soviet bombing aeroplanes from the cold war. The American planes had many facilities for pilots, like beds, coffee machines and so on, while the Soviet bombers didn’t have even a toilet(!) mounted on the board.

That’s a good analogy when it comes to comparing C with other languages – there is a lot of topics that programmers have to implement by themselves. Things as garbage collectors or dynamic typing. On the one hand, that makes C programs performance great, but on the other, it makes programmers take care of many things. In the end, coders have to check before running their program if they prevented the risk of memory leaks and other errors. As they say – quid pro quo.

Who knows - maybe it's that fast?
Who knows - maybe it's that fast?

Now you may be thinking about what the C language is used for. What’s the reason behind using this technology in the 21st century? Well, there are plenty of them.

Firstly, we must mind the fact that high-level languages as Python or Java require certain amounts of memory. You can run a Python program on a PC, a laptop or even on a mobile phone. However, some devices don’t have that much memory – for example, microprocessors or microcircuits. You don’t have to be a genius to guess that they can’t store too much data. Hence, it’s normal to program them in C language.

The other reason you may choose C for coding is making an operating system. It’s not a mystery that every effective OS must be rapid. Additionally, you have to concern about many different aspects of a project like that, like memory management, kernel stuff etc. Hence, if I were you, I would’ve chosen C or C++ to make an operating system because I would’ve had total control over all of these topics.

And last, but not least - maybe not my favourite, but still an important topic. C is still in usage for making compilers for high-level languages. Yes, you didn’t read it wrong, that’s true. If you do some research, you’ll discover that the Python compiler is written generally in C language. Moreover, it’s not the only case of using C for that purpose – Haskell programs are also compiled to C before they’re translated to machine code. Interesting, isn’t it?

History of modern programming languages in a nutshell
History of modern programming languages in a nutshell

Summing up, C language is like an old movie – I agree that nowadays’ films are generally better than the old ones (especially when it comes to CGI and all that fancy stuff), but still, some of the movies are timeless. As C has been with us for almost 50 years and there is no sign that it’ll be retired, we can say that it is just like an old movie. Sometimes, it’s hard to understand but still worth watching.