Author(s): Brian W. KernighanDownload
This book is meant to help the reader learn how to program in C. It is the definitive reference guide, now in a second edition. Although the first edition was written in 1978, it continues to be a worldwide best-seller. This second edition brings the classic original up to date to include the ANSI standard. From the Preface: We have tried to retain the brevity of the first edition. C is not a big language, and it is not well served by a big book. We have improved the exposition of critical features, such as pointers, that are central to C programming. We have refined the original examples, and have added new examples in several chapters. For instance, the treatment of complicated declarations is augmented by programs that convert declarations into words and vice versa. As before, all examples have been tested directly from the text, which is in machine-readable form. As we said in the first preface to the first edition, C “wears well as one’s experience with it grows.” With a decade more experience, we still feel that way. We hope that this book will help you to learn C and use it well.
Some Reviews: 434 in Goodreads.com
I read (most of) this book as an introduction to the C Programming language for a college course. While I certainly don’t disagree with the designation of this book as a “classic,” I would recommend the new guy to the C club in 2017 or later look somewhere else. While C, the language, hasn’t changed too terribly much since the 2nd edition was published in 1988, I believe that the way in which we use C has changed. I also didn’t really care to hear much about what changed between pre-standard C and ANSI C; the second edition treats this transition as a central concern of each and every chapter.
I learned C sufficiently well with this book. As a reference to the language proper, there may very well be no better introductory read; C itself is quite simple, as the authors admit, and who better to explain it to you than the people who created it? This book is a fascinating read and has great discussions about the implementations of classic UNIX commands and other systems programming topics.
With that being said, I think the 21st-century introductory C programmer should start somewhere else. Specifically, I feel like this book lacks a deep and thorough discussion of standard library functions, which, in my opinion, is the most important toolkit for anyone starting out. In other words, I wish this book didn’t tell me so much how, for example, malloc() might be implemented, but rather give me a more abstract view of how I might use it.
My advice: If you’re a new guy to the C programming language, look for a more modern reference that will focus on standard library usage, compilers, modern idioms, etc. You can circle back to this one later if you’re really hooked.
These are rather notes than a review while reading:
1. Use very descriptive names. Be consistent with your names.
2. A function should not do more than one thing.
3. SRP (Single Responsibility Principle): a class or module should have one, and only one, reason to change.
4. Stepdown rule: every function should be followed by those at the next level of abstraction (low, intermediate, advanced).
5. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.
6. The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification and then shouldn’t be used anyway.
7. Flag arguments are ugly. Passing a boolean into a function is loudly proclaiming that this function does more than one thing. It does one thing if the flag is true and another one if the flag is false.
8. Write learning test when using third-party cody to make sure it behaves the way you expect it to. And if codebase changes in time, at least you find out early enough.
Overall, this book is really great and exactly what fits me and my learning. The code-snippets are a little bit outdated, and may need a minor adjustment to compile on a modern system. This book was part of course material for a Swedish university class in Programming C, and I’m very happy to both complete the book and the course, and can warmly recommend it to anyone interested in getting into C.
This is the book that I recommend for developer regardless of what they are programming…
First you will learn how to work with command line on Unix or Linux or even windows… because the author when they wrote this book there is no any Operator System has GUI.
These days you can work on C programming language any debug it on more than one platform like Visual Studio or VS code.
I’m C# developer..but I love this book cause I learn many things from it
“Hmm I should update my C knowledge to C11” – I *skimmed* the first edition a long time ago, and it was quickly apparent that not much has changed. However it was nostalgic and comical, so I kept going. Reading this after doing modern software development was a wild trip – code examples seem like they were written by a crazy person, readability is thrown to the wind, and I long now for a time when I cared where in memory my variables were stored.