Take a look at the TIOBE Programming Community Index — an indicator of the popularity of programming languages — and you'll see that Google's Go and, to a lesser extent, Dart and Perl are trending up. The venerable C, however, is a language whose popularity is plummeting, according to the index.
In a world where there is huge demand for mobile and web applications coded in higher-level languages that are easy to learn and debug and difficult to make mistakes in — at least compared to C — one might assume there’s no reason to bother with a low-level language that's going out of fashion.
Does this mean that C isn’t worth learning? The answer isn’t quite that simple.
C is a fundamental language that is still in use in the IT industry. But that may change, says Mark Driver, a research analyst at Gartner. "They [C and C++] are the native tongue for system-level programming, and they probably will be for many years. Eventually, though, languages like Google Go or D may replace them."
"We see almost no demand for C or C++ among our IT centric clients," says Driver. "What we see is Java and other managed code languages being used," he says. "C doesn't allow you to address many modern architectural best practices, and the rise of languages such as Java and C# has been largely to address this."
But Driver says there's one rapidly growing area where there is likely to a be a huge demand for programmers with skills in C: the internet of things (IoT). He says that the rise of IoT could lead to a huge revival in the need for small footprint codebases and runtimes. "For traditional workloads there is no need to be counting the bytes like there used to be. But when it comes to IoT applications there is that need once again. So we may well see a resurgence in demand for C skills."
To C or not to C?
In the many forum threads on this topic, one popular argument in favor of learning C is that it is a little like learning Latin — you may never need to use it, but it makes other languages quicker to learn and easier to master.
Does that mean that C is the language someone considering a move into software development should start with? Fasten doesn’t think so. His view is that students’ time is better spent learning fundamental programming skills like developing algorithms or solving problems than tracking down bugs, which is likely to be necessary in C. "C is very error-prone, which can also cause security problems," he points out. "Other languages cut out 80 percent of the errors you would be likely to make in C."
Fasten also points out that people who take up programming without taking a full computer science degree often look for work in the web or mobile app development fields, where C is irrelevant. (That's because if an application is doing a significant amount of I/O — like a web app will — then the application will be waiting for the network for much of the time and the benefits of programming in C would be lost. It's only high-performance applications, such as data processing, along with low-level code, such as operating system kernels and drivers, that really need to be in a language like C.)
One person who has no doubt that C has made him a better programmer is Miguel Morales, a former AT&T, HPE and Cisco software engineer who is currently enrolled in online learning company Udacity's Self Driving Car Nano degree using C and C++. "Indirectly, a knowledge of C has made me a better programmer," he says. "Understanding how the machine works, how it uses registers to hold data, how the allocation of memory works, gives you an extra edge even when you are not using C. You become more responsible when creating variables, try to use the best algorithm available for a task, and use the 'continue' and 'break' commands to avoid executing unnecessary statements. And sure, modern languages have great optimizations features, but the point is that the extra responsibility you are granted gives you an edge in writing quality code."
Perhaps the most common view encountered when researching this article is that C is a language that's still worth learning, but only as a second or third language. That way you can get coding (and earning a living) relatively quickly, and then build a deeper understanding later. That's certainly the view of Raymond Phan, a computer vision engineer at Zebra Technologies.
"Some of the concepts of C are quite intimidating, so it is better to get a grounding in the fundamentals in a higher level language and then do a deep dive into C if you want to do high-performance programming," Phan says. "But otherwise I would just stick with high-level languages."
What about the idea that learning C makes learning other languages easier and makes you a better programmer? Phan has mixed feelings. "You are not going to be learning about memory management if you don't learn C, so I guess that learning C does give you an appreciation of what is going on 'under the hood' in a system. C can help with that, but when you go further with C it could just get confusing."
One final point: Could having a knowledge of C on your resume make it easier to get a job — even if the job doesn’t require it? Does C make you more employable?
"I think C is a benefit to have on your resume as it is hard, but you would still be evaluated on your relevant skills. So it would be a bonus, but not a deciding factor," says Phan.
Gartner's Mark Driver agrees. "The trial-by-fire of learning C tends to weed out the noncommitted, so a knowledge of C at the very least makes you stand out," he says.
This story, "Why learn C?" was originally published by CIO.