Wednesday, November 14, 2007

The C Programming Language by Brian W. Kernighan, Dennis M. Ritchie First Edition


ISBN-10: 0131103628
ISBN-13: 978-0131103627
This book (widely known as K&R, after the authors’ initials) has for over twenty years been the best way to learn C. When I got this book in 1980, I had access to a Unix system and worked through much of the tutorial material in it. On the way I learnt a great deal, not just about C, but about good programming style, code reuse, the value of clear comments--in short, I was introduced to the skill set of an experienced computer professional.

The book was a trendsetter in several ways. For example, the very first exercise given is to print "hello, world"; this is now seen as the first exercise in innumerable other, more recent books, many of which may not realize that they are borrowing from K&R. The rest of chapter 1 (there’s a chapter 0, an introduction; another geek-cool change which has been widely copied) is a tutorial that takes you through assignment statements, data types, if/else, for, while, printf, function definitions, arrays, and variable scoping, in less than 30 pages. If you work your way through the embedded exercises you’ll have written utilities to strip tabs, reverse input by lines, strip trailing whitespace from input, and several others. This is much more challenging than most tutorials, but the effect on the student is that you feel you are being treated as an equal. The book doesn’t talk down to you; it gives you accurate and concise answers. It’s written for programmers, in other words.

The next few chapters go back over the elements of C in more detail, and should also be treated as a tutorial. Going through this material religiously will be far more valuable than any college class could possibly be.

There is a reference section at the back, which is good to have. But the real value of this book is in the tutorial approach: it is a rare pleasure in the computing field to find a book that is simultaneously clear, stimulating and informative.

It is first edition

No comments: