Why Should You Learn C?


By Alex Allain

Why Learn C?

There are an awful lot of programming languages available right now -- everything from the extremely high level (such as Visual Basic) to the low level power of assembly, and a good variety of specialized options in between (Perl, Ruby, and Python are good choices for many tasks). Java has also become quite the hot programming language for some tasks, in part because of its large API and in part because the virtual machine provides some elements of security. (Garbage collection is another nice feature and can make programmers much more efficient.)



Nevertheless, there are some good reasons to learn to program in C. First, age has its advantages: C has been around for 30 years, and there is a ton of source code available. This means there's a lot to learn from, and a lot to use. Moreover, many of the issues with the language have been clearly elucidated -- it's well understood, and you can find a lot of tutorials available. Plus, with C, you get lots of strong opinions mixed with insights that you can understand.

As a result of its age and its use as the language of system programming for Unix, C has become something of the lingua franca of programming. C is a great language for expressing common ideas in programming in a way that most people are comfortable with. Moreover, a lot of the principles used in C -- for instance, argc and argv for command line parameters, as well as loop constructs and variable types -- will show up in a lot of other languages you learn so you'll be able to talk to people even if they don't know C in a way that's common to both of you.

Third, C is reasonably close to the machine. When you're working with pointers, bytes, and individual bits, things like optimization techniques start to make a lot more sense. There's also utility in knowing exactly how something works underneath the hood -- this helps a great deal when something you're trying to do in a higher level language seems way slower than expected, or just doesn't work at all. You also tend to get a better picture of advanced topics like exactly how networking works. A higher level language will make it a little bit simpler, but it'll be harder to understand what's going on, and when things stop working, it's much better to know exactly what's going on so you can fix it. Additionally, if you like computer science as a discipline, or just like knowing how things work learning the details of the system is great fun.

In fact, a lot of fun programming is done in C -- for instance, system software and data managers such as Berkeley DB. If you want to be able to do more than write a simple web app, C is a great language. If you want to write a great, fast game, C is again a great choice. You can write an entire OS in C. It'll be much harder to do so in Java, and nearly impossible in a scripting language. And the language, being succinct as C is, will probably make your fun program more elegant looking to boot.