Why you should learn C in 2020

Nov 09, 2018 - 6 min read
Educative
editor-page-cover

C is a middle-level programming language that is used to create both high and low-level systems. You can program a system, then turn around and design an application that runs on that system.

This marks C as a unique niche between an assembly language, and more high-level languages like Java.

Today, we’ll cover the history of C and let you know why its still used today.


Transition to C for FREE

Get the skills to start building your own C programs fast.

Learn C from Scratch


The history of C

If you’re involved in programming at all, you’ve heard of C.

Created by Dennis Ritchie at Bell Labs between 1969 and 1973, C has been around the block. It was the first general-purpose programming language to have an extensive user base and libraries.

C’s age does become apparent when applied to, say, front-end web development or building complex web apps. But there certainly is a niche that C will always occupy.

Even if you specialize in a different programming language, you most likely know a lot about C. It has been described as the “lingua franca” of programming languages.

Lingua franca: A language that is adopted as a common language between speakers whose native languages are different.

Python (a fully object-oriented high-level programming language) is based on C. Almost all abstract languages are still C, deep down. There’s a reason why C is often the first language you learn when you’re getting your CS degree.

C remains relevant because of its mid-level status. Its one of the few languages that is efficient for both high and low level systems. This means that C knowledge opens the possibility to work on any product.

widget

How is C used today

It’s easy to think C is old, outdated, or easily replaceable by some newer, trendier language. But now is actually the best time to get a good knowledge of C under your belt.

Look at the nearest gadget to you right now. It’s most likely powered by C. Your operating system, drivers, and even your browser are almost certainly written  in C.

widget

As the “Internet of Things” (IoT) continues to take prevalence in the world, a lot of it is powered by C. Firmware is inside everything nowadays. The portability of C means there are C compilers available for most hardware you can find.

It’s not just hardware either. Anything that handles huge amounts of data or requires optimal performance is usually written in C , due to its remarkably low runtime.

The world’s most popular databases, like Oracle, MySQL, MS SQL Server, and PostgreSQL, are coded in C. Ditto for Apache and nginx servers.

Today’s blockbuster 3D movies are created with apps written in C. These systems convert 2D images to 3D using many calculations per second. C helps them to run as fast as possible.

According to the TIOBE Index, C was showing a steady decline in popularity for years. In 2017 it shot up to #2 most popular, right behind Java, and has stayed there ever since.

widget
widget

One major reason why is because the automotive industry has latched onto C to build its self-driving car systems. All processing in autonomous vehicles is done in real-time and sometimes even in parallel architectures.

Since there’s so much C in the world, most newer languages have some way to interface with C. Its ABI is one of the easiest to interface with. Just the sheer amount of code out there written in C proves there will be a demand for C programmers for many years to come.

Replacing a system in C for an alternative would be much too costly, even for the most forward-thinking organizations. Theoretically, you could replace C with C++, or Go, or Rust, but there just isn’t enough of an incentive to switch.


Why you should learn C

Even if you’re a front-end developer, or more versed in object-oriented programming languages like Java/Python, there is still benefit to getting some C under your belts.

Here are some reasons you should learn C:

You want a deeper understanding of machines. The lower the level of language you use, the closer you are to writing machine code. With C, you’re writing close to the hardware AND directly manipulating memory. Understanding how memory allocation works, or how C uses registers to hold data, can give you an extra edge in writing quality code (even if you don’t use C).

You’re a beginning programmer and want to pick up multiple languages more quickly. Moving from one programming language to the next is a lot more smooth when you move up in abstraction. Highly abstracted languages are harder to learn if you don’t understand what’s being abstracted!

With C, you learn the foundations of modern programming, and then work up from there.

You want more job opportunities in a growing field. IoT is the future. You’ll continue to see an increasing demand for C programmers who can work with embedded technology. At the same time, there’s a low supply of C programmers right now.

You don’t see a lot of bootcamps or online courses for C, in the same way you do for Java, Python and the like. So, get in there on the ground floor.


Getting started with C

Let’s get your C journey started with a hello-world program. If you’re coming from C++ or Java, you’ll be right at home!

#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}

In line 1, #include is a preprocessor command that tells the compiler to include the stdio.h (standard input and output) file in the program.

The stdio.h file contains functions like scanf(), which takes input, and printf(), which prints output to the console.

Like Java or C++, C programs start from the main() function. We declare the main function on line 2 using int main() {. Any statements between the open and close curly braces is within the main() function.

In this program, the printf() on line 4 displays the “Hello, World!” text on screen. The semicolon ; acts as the end point for each C statement. You can think of the semicolon like a period in English.

If you use the printf() function without writing #include <stdio.h>, you’ll see an error and the program will not compile.

The return 0; on line 5 tells the program that this is the end of our function. Most functions in C end with a return statement.


Next steps

Congratulations on learning your first C program! As you continue your new C journey, you’ll need to learn some fundamental C concepts like:

  • Memory allocation
  • Data types
  • Function creation
  • Control flow

Educative’s free course Learn C from Scratch will walk you through all of these exciting concepts. You’ll explore hands-on live code lessons that start from the basics and let you build gradually.

By the end of this course, you’ll have the skills to work on your own C projects and a new understanding of programming languages in general.

Happy learning!


Continue reading about C


WRITTEN BYEducative

Join a community of 500,000 monthly readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.