Why learn C?

David Griffiths on C's consistent popularity and what the language can do for you.

Though C has been around for decades, it’s still consistently ranked at the top of any list of programming languages used and studied today. I recently spoke with David Griffiths (@dogriffiths), coauthor of Head First C, about the reasons for C’s continued (even increased) popularity and what his book offers in such an established market.

Highlights from our conversation include:

  • Why is C still popular? It’s ubiquitous, closer to the hardware, and used to create other languages and operating systems. [Discussed at the 0:32 mark]
  • What kinds of software is C used for these days? System programming (in pure C) or specialized areas when working with languages that are extensions of C or closely related (e.g., knowing C makes Objective-C programming for iOS apps more efficient and C++ games programming more intuitive). [Discussed at the 3:18 mark]
  • If you learn C, what will it do for you? Knowing C gets you closer to the hardware, to better understand how things work on the system level. [Discussed at the 4:55 mark]
  • Why write Head First C? Kernighan and Richie’s The C Programming Language is one of most popular, if not the most popular, programming books, and it defined the ANSI standard. That book is still the standard, but through the language hasn’t changed, the audience has, and many learners are coming to the language from a different perspective and set of knowledge. [Discussed at the 6:03 mark]
  • How does Head First C make the language more accessible to this new audience? For example, it teaches how memory works in a more profound way (a concept systems programmers will likely already know, though new programmers in specialized fields might not). [Discussed at the 8:12 mark]
  • Describe the labs in Head First C. The book includes three hands-on missions for the learner, presenting the project without completed source code. In the first project, the learner uses Arduino lab to program a flower with sensors to tell you when it needs to be watered. In the second lab, a computer vision system (OpenCV) is used to capture images in a web cam to check for faces, motion, etc. And finally, the learner creates Asteroids game clone, pulling together many different concepts from the book. [Discussed at the 11:13 mark]
  • Arduino is making C popular among the Maker community. As a constrained platform, Arduino is a natural environment for C. C makes the most of the machine’s performance, particularly with real-time processing of input/output. And because it’s such a small language, you can become competent in basic keywords rather quickly, making small Arduino projects a gratifying introduction to programming. [Discussed at the 13:54 mark]
  • Why should colleges continue to teach C? It’s an important, foundational language that requires you to understand the full stack of the technology. If you learn C, you’ll understand computers at a much more profound level than if you don’t. [Discussed at the 15:31 mark]

The full interview is available in the following video:

OSCON 2012 — Join the world’s open source pioneers, builders, and innovators July 16-20 in Portland, Oregon. Learn about open development, challenge your assumptions, and fire up your brain.

Save 20% on registration with the code RADAR


tags: , , , ,

Get the O’Reilly Programming Newsletter

Weekly insight from industry insiders. Plus exclusive content and offers.

  • Michael Kingsford Gray

    Why learn C?
    For the same reason that virologists learn about other common viruses.

  • Christian Sciberras


    C simply needs to die.

    C is the reason we still have a load of repeated bugs (read: the same mistakes all over your code).

    While C is powerful, very few developers use it correctly. And surprise, surprise, they’re definitely not the kind of developers that boast about C’s great features.

  • Sebas Sujeen

    @Christian : The only reason bugs exists is because of crappy developers. C gives you raw power that makes it possible to write relatively low level system applications like OS etc. Dont blame the language for the developers.

  • Kaveh Rassoulzadegan

    If one needs to learn how to write computer programs, it is important for him to train on, at least, one language that fairly deals across various abstraction levels.

    C is still the most complete (my take).

    The more the knowledge improves, less boring it becomes to learn and write lower level / performance critical code.

    A better understanding of what’s happening in there lets also better hack & fix urgent problems.

  • I learned only C and ASM.
    Rest of languages can be cultivated automatically, without any “learning”.

    I have made c# gui, export Cpp classes from a DLL, written a MFC wizard with almost no learning curve…just because I have mastered C.

    believe it or not.

  • Tom

    K&R is not still the standard!!! We’ve had an ISO committee overseeing this for two decades now, and I’m not learning C from anyone who hasn’t heard of it!

  • Normann Aa. Nielsen

    C is probably the most standardized low-level language in the IT-world. The quirks and strangeness in the language reflects the same quirks and peculiarities in the underlying hardware. So for that reason, C is important (it is a tad easier to read than the native assembly).

    That said, how many of us are doing low-level programming? If this is now what you do, then learn an object oriented language instead (C++ or better).

    As for @bhandarkar: You should not use the C-coding style in otherwise OO environments – it is a completely different coding style, and you can very well loose any advantage of OO. You cannot “cultivate” much OO from C / ASM, IMHO!

  • Mel Fegison

    Yeah ! C ?

    Why not Bender ?


    This state is like – let’s all great ideas been shooted into the heads …

    Why not start living in caves, hunting for food, and living another day as morrons ?!

  • rofl

  • I think every programmer must program C in many levels, isn’t necessary be an expert but u need understand the programming language and C give you the knowledges. Good article, i like it.

  • C is the most important programming language there is. Without C there would be no Linux, Windows, iOS, OSX, Android…

    If everyone only learns high level languages there will be no hardware progression therefore no new innovation.

  • Irné Barnard

    I slightly agree with the article. I think all programmers should at least have a bit of background on something like C. Just because it gives them a better understanding of what’s actually happening behind the scenes.

    You could argue the same concept for ASM, but in such case there’s no real “standard” per say. Each hardware platform’s ASM might differ greatly from the next.

    The point is: Even if you’re going to program exclusively in something like Python – it would benefit you greatly to think of memory usage and algorithm efficiency by knowing what the Python interpreter/compiler is doing to your code. It might alter your high-level algorithm to take a benefit from something which might make your code easier / faster / more robust down the line – since the actual implementation takes advantage of some hardware function instead.

    All that said, if someone’s going to write any program in C … they’d better become a guru in C … since anything less would be DANGEROUS! Remember: with great power comes great responsibility.

    But please … never take it that any programmer should ONLY need C. You need to become as good as you can in the language(s) you’re going to use most. I’ve seen ugly code in high-level languages because the programmer came from a C background and thought: “C is much more complex than this, I don’t need to worry about it”. And when I say ugly, it’s not a situation of the code is inelegant … it’s sometimes not making use of the built-in features (e.g. Functional programming). Or worse misunderstanding stuff like garbage collection by using global variables and setting them to null at the end, instead of making them local variables and having RAM cleared automatically.

    Same goes for OO concepts … C cannot teach you anything near to OO. For that C++ was invented, or rather it was approximated to some other much more comprehensive OO language.

    I’d say you need at least 3 greatly varying languages: 1 a near 2ndGen language like C, 2 an OO centric language (Java / C# / etc.), and 3 a functional language (Python / F# / Lisp / etc.). C is a good one to choose as the low-level language since it’s the most ubiquitous out there, for high-level you might find your language covers both functional and OO (e.g. Python / Lisp) so that may be combined into one.

    You need to at least know how such concepts can be used in other languages so you know when to use which. It’s no use using a hammer to remove specs of dust from a van Gogh, even if you know how to use the hammer to perfection. Conversely it’s no use using a toothbrush to cut a block of marble from a quarry. Same principle applies to programming: use the tool best suited to the task, but in order to know which tool best suits your task you need to know what the tool does.

  • jack marriott

    i confess, i am a c bigot – i have been using the language for more than 25 years, and i have been able to do things on smaller systems, with fewer resources, and still managed to get the job done. i like c++, java, javascript and python, but the first place i look to is c. i owe mrs k&r a lot of gratitude.

  • RDSchaefer

    “knowing C makes … C++ games programming more intuitive”

    I have to disagree with this. The single worst way to learn C++ is learn/know C first.

    I love C, I’ve know and used it since the ’80s so I’m very good at it but in order to write a C++ program I have to stop, clear my mind, and mentally shift gears into an entirely different mode.

  • Nikki Punjabi

    totally Agree…!!!
    it’s the basic of all the programming languages..!!!
    if you know c u can easily learn other languages..!!

  • Christian Sciberras, the fact that C gives you all the rope you need to hang yourself if you’re not careful is not a defect in C. If you do end up hanging yourself, it’s your own damn fault.

  • Hutch

    As in formal education directions, C serves an easily, taught and understood entrance into programming principles, techniques, and practises. As for as utility, other more robust and full-featured compilers or interpetors make development quicker. However, when the development is done, converting and implementing portions to c, c++, asm may improve performance drastically. Even simple tasks such as adding numbers or string manipulation can be impessively improved via dedicated,”closer to the bones” routines. By replacing highly repetitive procedures in lower level objects, libraries, may increase performance tons. From experiebce, by replacing just a few procedures in a database manipulation program, I saw a merge of new data improve from say 5 minutes to 15-20 seconds. If the routine is general enough to be used all over your code, performance can be drastically improved and controlled. An operation can be streamlined and enhanced with some bells and whistles and still run circles around a higher level compilers code because of fewer processor operations. A well-designed mix may pay off, especially as complexity starts to snowball and performance becomes an issue. Longer to get on the table but much more satisfying when served.

  • CUP

    It is the only language which many other languages like Fortran, Ada, Java etc have interfaces to. Many other languages recognize that there is something in C that they cannot provide or so they provide an interface.

    Re hangings: you can hang yourself in any language and it is almost always your own fault. I’ve done that many times in all sorts of languages.

    Re learning other languages: it would be better to learn C++ first then move sideways to C. If you do it the other way round, it takes a long time to work out how to use C++ properly.

  • Don White

    It is my understanding that many of the aforementioned languages were WRITTEN in C (including C++). To accomplish this feat, C programmers needed to be well versed in defensive programming and modularity. The new languages were created so that developers could focus more on their problem domains with less training in low level programming. As has been said before, use the right tool for the right job. But dont be prejudiced against C. Most of the firmware development tools i have seen lately allow developers to code in C.

  • Hector Hugo Alpizar Ceseña

    C/C++ now a days are adaptable for most of the devices. If you have code, libraries or API it could be reusable.

    It’s kind of complicate when your a dealing with memory issues, pointers and all that, but if you thinking to write a core/engine/data-process type-a-like code C/C++ is the best option.

  • Winston Lee

    You guys are probably going to think I’m weird, but I think you should learn C++ first, then C. I had trouble getting the OO stuff for quite a while, simply because I was stuck in the “Data Structures + Algorithms = Programs” (anyone remember THAT text?) for so long.

    I think the reverse would have been much easier, since you’re just dealing with a subset.

    Just my 2 cents.

  • TBruce

    If you don’t know C, change your profession.

    Just like if you never read The C Programming Language book, change your profession.

  • Dave

    Didn’t learn C from K & R in 1986, was too obtuse. Used another book by someone who knew how to teach a programming language.

    Learning C is preparation for the abuse you will suffer from C++. Thought that C++ took a sweet little functional language and turned it into a nightmare. If Microsoft hadn’t pushed the living hell out of it, it would have never caught on.

  • Armando

    You are invited to visit “TIOBE Programming Community Index” at : http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

    See the trends in computer language. Right now plain C enjoys the first position, with Java and C++ slowly going down and Objective-C going up.

    After decades still at the top. Think about it.

  • Geoff

    (C# developer 3yrs) Read all these great responses and took a look at the book so as to make a purchase …. eurgh!

    Can anyone recommend a sensible C book for a serious and well established programmer well practiced in OOP?

  • It has been nearly a decade since I last used C and I don’t think I will ever return to it. Even if I had to do some low-level programming, I would probably use Go instead of C.

    Nonetheless, I am very grateful that my first programming language was C, because it gave me an excellent foundation for understanding how computers work, data structures, hashes, stacks, trees, memory management, and all the other fundamentals that get obscured by higher level languages. It taught me many of the basic concepts which have stayed with me for the past 2 decades.

    People tell me the same thing about Lisp. They say that I should learn Lisp not because I will use it very much, but because it will make me a better programmer.

  • Anonymous Coward

    As a Java programmer who also knows both C and C++, I hate it when I need to interview people with no clue about any language closer to the hardware. It’s really difficult to determine if they do or don’t understand how a computer works.