Many programming languages have come and gone since Dennis Ritchie devised C in 1972, and yet C has not only survived three major revisions, but continues to thrive. Large chunks of Windows were written in C, along with most of Linux.
But aside from this incredible legacy, what keeps C atop the Tiobe Index? The number of jobs on Dice.com for C programmers is not huge, and many of those also include C++ and Objective-C. On Reddit, the C community, while one of the ten most popular programming communities, is half the size of the C++ group. (Of course, after more than four decades, maybe there’s not a whole lot of new material published about C!) (Aside from this article, of course.)
Despite being overshadowed by other languages, I believe C remains relevant for the following reasons:
It’s Easy to Learn
The only advanced features in C are pointers and function pointers. Once you’ve mastered those, you’ve pretty much learned the language. Knowing C provides a handy insight into higher-level languages—C++, Objective-C, Perl, Python, Java, PHP, C#, D and Go all have block syntax that’s derived from C. And reference variables in C# will be easier to understand because you know C pointers.
It’s Still Used
There is an immense amount of software written in C that’s still used, including Apache and NGINX Web servers, MySQL, PostgreSQL, SQLite, Ingres database, GIMP, CPython, Perl 5, PHP, Mathematica, MATLAB and most device drivers.
From the end of the 1980s until the early 2000s, developers relied on C to develop games, with C++ taking over after that. There’s so much C source code still around that learning to program games in C using the SDL library is not hard.
The Internet is basically driven by C applications. Most browsers are written in C++, but C code is used for the infrastructure, mail sending utilities, DNS utilities, etc.
Some modern compilers generate C as an output stage. This saves the compiler-writer having to create a code generation stage for each platform.
Need for Tight Coding
The increased availability of low-cost processors with small amounts of RAM and ROM requires tight coding, and C fulfills that role perfectly.
It’s not been all rosy for C, especially with Internet-facing code; many of the vulnerabilities that have plagued Microsoft and other vendors are due to C functions that don’t do bounds-checking and end up called by buggy code. (Networked computers weren’t so commonplace back in the day, and no one predicted that malware writers working remotely would seek to exploit these unsafe functions.) These vulnerabilities have now been examined and a large number of C functions banned from use, replaced with safer versions that have an extra parameter (usually a limit value).
Newer C Compiler Support
Fifteen years on, the C99 standard is largely supported in compilers such as GCC and Clang, along with several commercial ones. The C11 standard, however, is still too new to be fully implemented, although it has partial support. It’s a reasonable guess that the most popular version of C is still C89 (also known as ANSI C). But with CPUs having greater numbers of cores, it’s likely that C11 will be a necessity in a few years because of its thread support with the threads library.
Is C Still Relevant?
Yes. It’s easy to learn, there’s a lot of it still in use, and plenty of free or open-source compilers. While it may not get you a job, it will give you an excellent grounding in low-level programming. It’s not growing in popularity… but it’s not going away anytime soon either.
By David Bolton | Dec 8, 2014