LizardKing has sent us a review of John Perry's Advanced C Programming by Example. Covering topics such as pointer trickery, string manipulation and dynamic data structures, this book is designed for those of you who are looking to fine-tune your C skills. Click below for more information.
Having been given a book voucher for Christmas, I duly trotted off to Blackwell's bookshop in Oxford to see what I could spend it on. I did the obligatory check for new O'Reilly titles, before turning to the C books. A hardback copy of Kamp II to replace my dog-eared paperback would've been nice, but first I decided to flick through Advanced C Programming by Example. The contents page promised examples of pointer trickery, string manipulation and dynamic data structures. I consequently bought it.
There is very little to fault this book on. It is written in a clear and enjoyable manner, which is about the best you can hope for from a programming guide. My only real criticism is the lack of a bibliography. For instance, cryptography is mentioned in the chapter on bit manipulation, but no references to further reading are given.
The introduction explains the rationale behind producing another C book by pointing to the dearth of intermediate level texts. The author also criticises the current emphasis on OO languages with their larger vocabulary and more abstract concepts.
The first chapter highlights the importance of coding style to aid maintainability, and the valid use of features like the ternary and comma operators. This is followed by an excellent review of pointer theory. I always judge a C book by how clearly it describes the purpose of pointers - and this one does it superbly.
Subsequent chapters contain in depth analysis of key data structures like singly and doubly linked lists, binary trees, etc. While most C books include examples of these, they are particularily well described and illustrated. Other important techniques like hashing (both to memory and disk) are introduced, with common pitfalls highlighted.
The bit manipulation chapter is comparable with those in other C texts, but is unusually clear and consistent. The same can be said of the advanced I/O chapter.
The chapter on string manipulation uses dynamic memory allocation, arrays of pointers and the more obscure ANSI C string functions for 'real world' examples. This is another area where many C books fall down, ignoring the fact that the strings many programmers deal with cannot be expected to fit into fixed length arrays.
The final "Pot-Pourri" chapters include a discussion of complex function declarations that both expect and return function pointers. A number of other rarely described but expressive features are also covered.
So What's In It For Me?
If you consider yourself a C expert, then this book may be superfluous, as it covers ideas and principles you should know intimately. But if like me you're spending more time with scripting languages like Perl, you may need a handy reference for those forays back into C.
Buy this book here.
Table of Contents
- Optimal C Coding Style
- Review of Standard Pointer and Array Operations
- The Linear Dynamic Data Structures: Stacks, Queues and Linked Lists
- Advanced String Handling
- Advanced Input and Output
- Bit Manipulation
- Recursion and Binary Trees
- Multidimensional Arrays and Arrays of (Non-Char) Pointers
- Potpourri: Part One
- Potpourri: Part Two
- Answers to Selected Exercises