Submind YouTube summaries
Thumbnail for C Programming Language | Brian Kernighan and Lex Fridman

C Programming Language | Brian Kernighan and Lex Fridman

Watch on YouTube

Video summary

In this discussion, Brian Kernighan reflects on the enduring legacy of C and his co-authored book, *The C Programming Language*, which he considers one of the most impactful works in programming history. He attributes the language's longevity to its unique combination of expressiveness and efficiency, allowing developers to write naturally while maintaining high performance even with the limited computational power available fifty years ago. Kernighan highlights that C found a perfect synergy within the Unix environment; because both the operating system and essential tools were written in C, programs developed on one machine could easily be ported to others running Unix. This created a positive feedback loop where the language's utility reinforced its adoption across dozens of systems, cementing its status as a foundational technology that has survived nearly five decades of Moore's Law advancements. The creation of what became known as "the definitive book" on C was not part of an initial grand plan but rather an accident of timing and circumstance when Kernighan and Dennis Ritchie began working in 1977. At that time, Unix systems were spreading rapidly across dozens to hundreds of computers, yet there were no other books available; Bell Labs remained the sole source for information on C. Recognizing that Dennis Ritchie was an authoritative figure who had already written a superb reference manual, Kernighan persuaded him to expand into a full book. The resulting text benefited from Ritchie's exceptional writing style and crystal-clear prose regarding syntax, while Kernighan focused heavily on crafting expository material and selecting examples. They worked collaboratively through a process of refining ideas back and forth, ensuring the content was both educational and practical for readers learning the language at that specific moment in its evolution. Kernighan emphasizes that the power of good programming lies in using representative examples rather than isolated syntax exercises. He notes that many modern books fail by presenting trivial tasks like adding three numbers without explaining how to acquire or format those inputs, whereas their approach focused on realistic text processing problems typical of Unix environments. The book featured simple yet meaningful projects such as copying input and outputting it again, similar to the `cat` command, or reading data and transforming it before writing results out, akin to a `grep` operation. These examples were chosen because they represented fundamental tasks programmers actually wanted to accomplish, allowing readers to understand core concepts while seeing how code could be modified for their own specific needs. Ultimately, Kernighan argues that the true value of these examples is providing something directly useful or highly representative of real-world utility within a vein of text processing—reading input, manipulating it, and writing output. He admits that no book can be perfect in its attempt to cover every scenario, but their goal was consistently to demonstrate how to do things that felt genuinely helpful rather than purely theoretical. By grounding the learning experience in practical applications like reading files or formatting data neatly, they aimed to show programmers not just *how* to write code, but why it matters and what problems such code could solve. This philosophy of teaching through realistic, useful examples helped establish a standard for how C should be taught and applied, influencing generations of developers who continue to rely on the language today.
Read the full video transcript
so what's to use you wrote a book c programming language what and c is probably one of the most important languages in the history of programming languages if if you kind of look at impact what do you think is the most elegant or powerful part of c why did it survive why did it have such a long lasting impact i think it found a sweet spot that in of expressiveness so you could really write things in a pretty natural way and efficiency which was particularly important when computers were not nearly as powerful as they are today you can put yourself back 50 years almost in terms of what computers could do and that's you know roughly four or five generations decades of moore's law right um so expressiveness and efficiency and i don't know perhaps the environment that it came with as well which was unix so it meant if you wrote a program it could be used on all those computers that ran unix and that was all of those computers because they were all written in c and that was unix the operating system itself was portable as were all the tools so it all worked together again in one of these things where things fed on each other in a positive cycle what did it take to write sort of a definitive book probably definitive a book on all of program like it's more definitive to a particular language than any other book on any other language and did two really powerful things which is popularized the language at least from my perspective maybe you can correct me and second is created a standard of how you know the the how this language is supposed to be used and applied so what did it take did you have those kinds of ambitions in mind when we're working on that this is some kind of joke no of course not um so it's an accident it's an accident of uh of timing skill and just luck a lot of it is it clearly uh timing was good now dennis and i wrote the book in 1977 yeah right um and at that point unix was starting to spread i don't know how many there were but it would be dozens to hundreds of unix systems um and c was also available on other kinds of computers that had nothing to do with unix and so the language had some potential um and there were no other books on c and bell labs was really the only source for it and dennis of course was authoritative because it was his language and he had written the uh reference manual which is a marvelous example of how to write a reference manual really really very very well done so i twisted his arm until he agreed to write a book and then we wrote a book and the virtue or advantage at least i guess of going first is that then other people have to follow you if they're going to do anything and i think it worked well because dennis was a superb writer i mean he really really did and that the reference manual in that book is his period i had nothing to do with that at all um so just crystal clear prose and very very well expressed um and then he and i i wrote most of the expository material and then he and i sort of did the usual ping-ponging back and forth you know refining it but i spent a lot of time trying to find examples that would sort of hang together and that would tell people what they might need to know at about the right time that they should be thinking about needing it and i'm not sure it completely succeeded but it mostly worked out fairly well what do you think is the power of example i mean you're you're the creator at least one of the first people to do the hello world program which is like the example if if aliens discover our civilization hundreds of years from now it'll probably be hello world programs just to have broken robot communicating with them with the hello world so what and that's a representative example so what what do you find powerful about examples i think a good example will tell you how to do something and it will be representative of you might not want to do exactly that but you will want to do something that's at least in that same general vein and so a lot of the examples in the c book were picked for these very very simple straightforward text processing problems that were typical of unix i want to read input and write it out again there's a copy command i want to read input and do something to it and write it out again there's a grab and so that kind of find things that are representative of what people want to do and spell those out so that they can then take those and see the the core parts and modify them to their taste and i think that a lot of programming books that i i don't look at programming books a tremendous amount these days but when i do a lot of don't do that they don't give you examples that are both realistic and something you might want to do some of them are pure syntax here's how you add three numbers well come on i could figure that out tell me how i would get those three numbers into the computer and how we would do something useful with them and then how i put them back out again neatly formatted and especially if you follow that example there is something magical of doing something that feels useful yeah right and i think it's the attempt and it's absolutely not perfect uh but the attempt in all cases was to get something that was going to be either directly useful or would be very representative of useful things that a programmer might want to do but within that vein of fundamentally text processing reading text doing something writing text you