on May 27, 2000
I have browsed some C and C++ books in major bookstores to see how the materials are organized and presented. This one was not a book I had a chance to browse, but one which I had to buy for an extension course (Introductory C Programming) at UCLA last summer.
At first I thought King's book was hard because of a certain depth of penetration into elements of good programming practices with examples one after another. As I became serious and started to reading intently, I found out how effective King was in paving the way toward a comprehensive understanding of C programming through worked out code and annotations. King is very skilled in breaking down and building up C code, unlike certain celebrated C programming language experts who apparently do not care to be clear or are simply ineffective. So my conclusion is: Read this each chapter of this book very closely, carefully and seriously, and try to understand every last point King is raising. Also, do not neglect working out some of his exercises at the end of each chapter for the benefit of practice as well as learning C. In almost every chapter of the book, he gives very good, organized and annotated but not tedious and complex examples. The problems are generally reasonable and hardly ever too complicated because I never found them overwhelming, either from a coding perspective or mathematically. Perhaps it is because King comes across as someone who emphasizes organization, detail, clarity and explanation in his style of presentation. There are no problems dealing with heavy scientific or engineering applications for those who dread them.
Great points: (1) Fundamentals - beginning chapters goes into detail for a solid grounding of C language basics (syntax, etc.); and (2) Pointers - excellent exposition with examples, diagrams and exercises, extremely well presented for the starters who easily get confused by what pointers in C are all about; and (3) Ideas are very well connected from chapter to chapter -- some chapters are even as great as stand-alone ones for referencing. The only problems I found were: (1) Description of struct types, which are passed by value from function to function -- implied but not clearly or succintly stated in the book (compare the description in the excellent book by Kelley and Pohl, "A Book in C"); (2) Chapter on program design, which I found to be very terse and scanty in terms of information topics about designing medium size to large C programs -- also jumps into encapsulation and C++ too soon and leaves out one too many basic ideas in C program organization -- "Look before you leap", C++ is object-oriented, and is therefore much more complex and evolved, so why do too much of C++ when one must learn basics of ANSI C well beforehand!
For some reason, I feel strongly that King is following the writing style and presentation of the classical work in C programming by Kernighan and Ritchie. He even discusses the significant contributions of Kernighan in establishing the C language as the mainstay of modern programming for all kinds of applications. There are some uncanny resemblance in style and other parallels I sense in his book. King also retains a lot of the clarity in thinking and intrinsic simplicity reflected in Kernighan and Ritchie's writing style.
Because of the lengthy chapters and reading required, this is not the best ANSI C reference book in my view. Kelley and Pohl's excellent paperback, entitled "A Book in C", does far better in that respect. However, King has more good illustrated examples in his book for the newcomer. You will like his book if you like Kernighan and Ritchie's paperback classic. In fact, King has more for you. The only caveat may be that any newcomer would be well advised to try to understand a little about C before attempting to read the book, because only afterwards does King's treatment only makes sense and becomes meaningful and stimulating. Also, it may help out considerably if one finds a good instructor to teach ANSI C in formal classroom environment using King's book here (as I did last summer at UCLA Extension).
All in all: A very good no-nonsense book for the motivated beginner in C programming.
on May 31, 2008
I ordered K.N. King's ``C Programming: A Modern Approach (Second Edition)'' from Amazon for my recent birthday. Having had more birthdays than I care to admit, this gift to myself is right up there with a Lionel train set I got for my eighth birthday (not from Amazon, of course -- it didn't exist that long ago but passengers trains sure did :)).
In this second edition, I think that KNK is now the logical heir to K&R. That's not meant as blasphemy -- Kernighan and Ritchie's still great volume is around 20 years of age and it's unlikely they'll be getting together for K&R3. The C language has undergone enough changes (with the amendment of 1994) and C99, that a ``Modern Approach'' really is needed.
There's another author familiar to readers of the comp.lang.c newsgroup for his approachable, engaging writing style. That author is a wonderful writer but doesn't let the truth get in the way of good narrative. King, though, is an equally engaging writer but is obviously passionate about correctness and adhering to the C standard. He's also meticulous about portability so that the examples are written in pure C and not some platform-specific variant.
I've the entire book and can find hardly anything even nitpick. Aside from a minor style difference about using parentheses with the ``sizeof'' operator, which King explains his rationale for doing so, that's about it.
His explanation of C99 (and the differences from C90 are clearly indicated) made me aware of some really nice features of the current standard for the language (and makes me wonder why one very notable compiler implementer hasn't yet supported C99).
In short, get this book. The Q&A sections at the end of each chapter are very well done. The exercises and programming projects help to amplify the material presented. And King's examples will teach you more about barcodes and ISBN numbers than you ever thought possible.
If you can appreciate the work of a fine craftsman in film such as Martin Scorsese, you'll find that King is of that caliber in the realm of lucidly dealing with this technical subject.
on November 9, 2009
Some years back, someone mentioned the first edition of this book on Usenet as a possible alternative to K&R for someone trying to learn C. I was surprised, but I got a copy of the book to find out... And he was right.
Let me get the biases out on the table first: I did technical review of this book for the 2nd edition. But... While that leaves me in a great place to be biased about it, it also means that I'm aware of just how few typos or bugs were there even in the draft versions.
This book is an excellent teaching resource; it covers the language carefully, completely, and well. However, mere clarity of communication isn't enough to make a good programming reference; you also need to have confidence that the example code works as described, that the explanations given are correct, and so on. This is one of the only books out there I feel comfortable recommending to people, without worrying that I'll end up having to correct dozens of misconceptions later.
Quite simply, this is the C book I recommend to people who want to learn C, or polish up their C. In a market full of "approachable" books which are full of errors, this book offers a combination of clarity and accuracy which is unmatched.
on July 25, 2004
This is the second of King's books I have purchased. It is also the second that I am very very pleased with.
This book presents a quick systematic clear way of learning to program in C period. This has to be the easiest programming book I have ever read that goes beyond absolute basics.
Frankly I don't understand the few negative reviews others have given the book. Yes it would have been nice to have answers to the exercises. However this is a programming book, you get the answers yourself by doing the work. Mistakes are readily apparent, simply because it won't work!
In terms of difficulty, the exercises are doable. There have been a few that did stump me.....for a little while. With a bit of rereading and some experimenting, I have managed to answer all that I have attempted.
Do yourself a favor if you are learning C and buy the book either as a stand alone or as a supplement to another book.
on March 8, 2013
I've read a few "language agnostic" books and a few "language-specific" books over the past 2 years. There is generally a wide schism between these two types of books. Let me summarize them here:
Language Agnostic (examples: SICP, Introduction to Algorithms, Introduction to Computer Science):
These books focus on building programming fundamentals. Yes, SICP and Intro to CS use Scheme and Python respectively, but they focus on offering you the foundations to write useful and delightful programs. These aren't "cook books:" they teach you how to think through and understand problems and how to solve them with computers. Most notably, there tends to be many exercises at the end of the chapters that enhance your understanding of the material. These books tend to be long and dense, but well worth the effort.
Language-Specific Books (examples: Clojure Programming, Definitive Guide to Drupal):
I've learned to loathe these kinds of books. While they give you an overview of the features, they really never go through how to combine and mix the parts to make you more comfortable with the language or framework. The thing I hate the most is the incessant language-bashing and chatting up how incredible the languages are. I'm not saying they aren't worth the money, as they usually are, but they tend to only be a starting point, leaving many questions unanswered, and all the talk about "Doing it the hard way or the Drupal Way" and "Clojure raising your game.. and oh yeah, Python, Ruby, and Java sucks" takes away valuable real-estate to get you on your way to confidently use the language when you are done reading it and ultimately distracts me from the learning material. If I wanted to be indoctrinated, I wouldn't spend $30 for a book; I'd read a blog for free.
So, what is C Programming: A Modern Approach?
It's a beautiful mix of both of the above approaches. The book, as its name implies, tells you how to program in the wonderful C language. Yes, it mentions other languages in passing in the thankfully brief introduction, but there is no bashing. The author chose to teach you how to program in C from the bottom up and let you to decide what to do about it.
This book offers the best explanation of the entire language I have ever seen. It is more thorough, modern, and complete than K&R. From the first few chapters, where you'll learn about printf and scanf, the author takes the time to describe in minute detail all the tiny nuances of the C language. If you are seeking understanding of this language, you simply cannot find a better source.
The book takes the great parts from "agnostic" books by offering tons of exercises that will delight your inner programmer. I never knew how a reverse function worked, but after writing my own reverse program, I felt enlightened. The programs have the added benefit of being relatively easy to write yet somehow able to teach you what it was trying to show you. Even if you aren't interested in learning C per se, this book will teach and reinforce many programming concepts. It is probably easy enough for a beginner to work through, yet difficult enough to delight experienced programmers all in one shot. This is an incredibly difficult target to hit, and this is one of the few books of any genre to pull it off.
I cannot suggest this book enough to anyone who has been searching high and low for a good C learning resource. The author clearly knows what he is talking about. The pacing is wonderful and I don't recall finding any programs that broke. I feel like I am sitting in the classroom of an infinitely knowledgeable and engaging professor when I read this book. It is one of the few books on programming that I have read that I feel like is worth reading from front to back, and it is one of the few programming books that has kept me engrossed in the material for hours on end. Most importantly, after searching for good C learning material, I finally feel like I "get" the language.
Thank you so much for a wonderfully written and designed book, K. N. King.
on May 29, 2012
There is no other way to put it. If you want to learn C programming, this is the only book you need. Don't bother mixing bits from different books or sources. Just get a copy of the 2nd edition and read it in the presented order, from chapter 1 and move on progressively. The explanation is very clear and the questions actually encourage you to find the right reasoning and develop your thinking skills, so you "think" like a programmer. I didn't know anything about programming and this book marks a landmark in my life, as it allowed me to truly appreciate programming and the power of code by being a developer.
I would have expected a 3rd edition by now, containing the minor fixed errata with more questions and examples (it's been 4 years since the 2nd edition was released), but the 2nd edition is very well presented and until the 3rd edition comes out (probably 2013 or later), this book is the best in its class. Buy it and you'll never regret it.
on December 9, 2014
I was using Zed Shaw's Learn C The Hard Way and realized that the hard way doesn't build up a good foundation of knowledge. I needed something that I can use to learn some basic aspects of the C language and this does the job. Not only is it well written and approachable, there are numerous end of chapter exercises that allow you to implement chapter specific techniques. I respect Zed's approach, but sometimes things need to taken out of context of the bigger picture to appreciate the constructs.
Later on in the book, KN King tackles on some C standard library specifics header by header. I appreciate how I can quickly figure out what each function of the standard library does after reading the back of the book reference. The chapter on the C Preprocessor has allowed me to make some pretty cool macros and understand how they all unwind. In addition, good practices are also mentioned, although not as frequent as in Zed Shaw's book. All in all KN King really does elucidate the language with this book.
on November 9, 2013
This book is the only one which truly excels K&R. C has a very simple set of rules, and if you only look up the syntax, you could learn it in few days or even in hours. But you can never learn C programming in this way, even if you are an experienced programmer in other languages. C is simple, but it doesn't mean that C programming is simple. In contrast, C programming is one of the most complex one(Yes, assembly programming is more complex, but it normally isn't used in big and complex projects.)
C also unlocks the safety. The first sentence of C99 Rationale is "Trust the programmer", which means you should know exactly what your code is doing. Modern languages are more or less framework-like system. Most of the program structures and how you should program, are already fixed at the language level and they aggressively restrict the "unsafe" approaches to ensure your productivity and the program's safety in that pretty, virtual wonderland. But C is a completely different beast. It does just what you code, no more or no less. It reveals the real dirty pity dangerous computer system, which underlies the pretty virtual world. You can do anything there and C doesn't force you anything. This freedom also reveals all the little ignorance and you are the only one who is responsible for.
In that point of view, the simple C is actually much harder than other big fat complex languages. Learning C programming is learning the survival methodology in such a dangerous environment.
I bought other books first, because this book is way more expensive than others, but all of them except for K&R are just overly simplified syntax-oriented reference manuals. Such books are just like math books, which only explain the axioms and definitions, and all other non-trivial theorems/proofs are left to the reader as an exercise. In fact, they explain C as an abstract high-level language, as if you can play on the safe ground without worrying about anything. Then, the reader may think the author has explained well, because they could read the book easily. But in reality, they hide an important fact that C is an half-closed language, in which many undefined behaviours or hardware-dependent things occur. The conditions, exactly why and when they occur, how to avoid them, and finally, therefore how to program in C, are actually what you should learn. Some of them are easy and many books explain such a basic thnigs as well, but there are also many things for which you need a deep knowledge in C. They fail to explain such things or just hide them, because it requires experience and accuracy, and that is a hard and tedious work. Secondly, why do people use such an inconvinient language today? There are many reasons, but one of them is the transparency. When you program in higher-level languages, you concentrate on the logic in the abstract computing model, the language offers. This is a nice part of the high-level languages, but it is increasingly difficult to see how it is done behind the scene. And there is a situation, you may want to know that, for example, for better performance or for security or for whatever. This is one of the most important reason, why do people use C today. If you know C well, you can picture exactly what is done in the computer memory. But if you learn C as a simple high-level language, it is not the case. One of the most important reason, why you need C today, goes away.
Only K&R could manage them all. But while K&R follows the right way, it is way too old, expects a fair amount of programming experience and mainly focuses on to give useful advices when programming in C.(But, since many features of C reflect the hardware architecture and C itself is de facto the lingua latīna of the mainstream programming languages, the advices apply to many other languages.)
In contrast, this book requires no prerequisites. But it doesn't mean that this book is only for novices. In fact, its scope far exceeds K&R and many advanced topics related to C are explained with greater detail as well. The author uses many figures and examples codes to make things clear and gives many related exercises. While K&R shows what C is and how to program in C, the author of this book really devotes to "train" the reader to be a good C programmer. In addition to that, he made an additional Q&A sections after each chapter, which explain many potential 'why?' questions of the reader. Sure, while K&R is just under 200 pages, this book is over 700 pages.(except for appendixes for both of them.) So, I'm sure you'll get much more from this book than K&R. The fame and crown of K&R should now be awarded to this book. It is a bit expensive, but the (value/price) is far higher than others. If you are serious to learn C, this book is the one and only currently.
My only wish is to see the third edition for C11 standard.
on December 15, 2013
I bought this book because it was the required text for my c programming class. I usually buy my textbooks and then sell them back because it's cheaper in the long run than renting. I'll be keeping this one though. The book is conveniently arranged so that the material is easy to find when you're programming and have a quick question. It is also presented in a way that reads well when you are trying to learn something new. Everything is explained in a way that clear and easy to understand. It contains examples, explanations, and a q&a section in each chapter. The chapters are long enough to be thorough, but short enough that they don't become tedious. I highly recommend it!
on October 17, 2012
The 2nd edition is a better choice. It contains Q&A which brings much more insight going beyond just the mechanics of the language itself. Then, its problem sets often relates to algorithms, than just ad-hoc or mechanics of the language covered by most other language books. On top of that, it is very comprehensive to enough for building and strengthen a beginner who aims for more in-depth thinking. It leads further toward data structure, file system, memory management, as well as system level development as well. Although this is a college level book used for more in-depth studies for beginning students, I have my my robotics middle to high schoolers to use this book for develop their thinking, programming, and design skill. Yes, this is an expensive book. But, this is really for a long term investment for these young folks. This is really for long term in building and strengthening their ability in writing robotics software.
However, I must say this is not for those who are interested in only learning the mechanic of the language though. If that's you, you should go for this book first instead: Programming in C by Stephen G. Kochan instead. This is an excellent book comparing to others. I initially used Kochan book as well, but found do not have enough exercises for more in-depth thinking, and encouraging more algorithmic thinking as well.