Forgot your password?
typodupeerror
News Books Media Book Reviews

Advanced C Programming by Example 47

Posted by Hemos
from the learn-by-seeing dept.
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.
Advanced C Programming by Example
author John W. Perry
pages
publisher PWS
rating 9/10
reviewer LizardKing
ISBN
summary An unusualy well written C textbook, that picks up where most other programming guides finish off.

The Scenario

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.

What's Bad?

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.

What's Good?

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

  1. Optimal C Coding Style
  2. Review of Standard Pointer and Array Operations
  3. The Linear Dynamic Data Structures: Stacks, Queues and Linked Lists
  4. Advanced String Handling
  5. Advanced Input and Output
  6. Bit Manipulation
  7. Recursion and Binary Trees
  8. Multidimensional Arrays and Arrays of (Non-Char) Pointers
  9. Potpourri: Part One
  10. Potpourri: Part Two
  11. Answers to Selected Exercises
This discussion has been archived. No new comments can be posted.

Advanced C Programming by Example

Comments Filter:
  • while I agree that C is error-prone, it's also the most powerful language I've ever encountered, and that's exactly why I stick with it.
    C is very much like unix: more power than you can handle, and if you burn yourself, it's your fault. I've yet to find a C problem that way not caused by bad design and/or bad implementation.
    and taking care is the prize you pay for power. so if you can't handle it, then stay away from it. but stop telling me what to do. thank you.
  • Or ada or any other strongly typed language...

    I spend a lot of my spare time programming embedded systems in C...and some of it is a real grind compared to the day job programming in Delphi/Object Pascal. What language would allow this!

    if ( Finished = TRUE )
    {
    PerhapsIllNeverGetRun();
    }

    It is my experience that C zealots rarely know many other languages
  • Big deal, so you use a typedef to mask this in the libraries. What's your point?

  • 1) People write programs to solve problems.
    2) Problems are complicated (in general), and require
    complicated solutions.
    3) "Efficicent" [1] languages like C/C++ make the programmer
    deal with complexities that are unrelated to the actual problem.
    4) Hence C is not my favorite programming language.
    [1] When people say "C is efficient", they are talking about
    the speed of the resulting executable. OTOH 99.44% of the time,
    it is much better to optimize *Programmer Efficiency*.
  • by kip3f (1210)
    Sure. At the moment, Perl is my favorite programming language. There are a few misfeatures, like allowing both $foo and @foo, my $bar has nothing to do with *bar, debugging can be challenging due to the permissive nature of the language, no symbol for handles (they are a first class type, and deserve to be treated like one!).

    What I would really like to see is increased flexibility in the typeglob. This should be a (C style) union [typesafe ;-)], where you can add new types (eg: a tree type). Also, more TIE* stuff.
  • Amazon $45.95
    AlphabetStreet (UK) $34.25
    BarnesAndNoble $44.95
    Dymocks (AUS) US$31.29
    Spree $36.76

    Regards, Ralph.
  • C is the basis of C++ (A real hack job of a programming language held together with baling wire and duct tape to give C programmers an OO language (it's not a real OO environment, but an incredible simulation!) without having to learn a whole new language.).
    If you think C++ is so great for things like kernal programming then look closer at why Win95 crashes so much. Did you ever notice that modules don't always load in the same sequence?
    Saying that C is dumb just proves what an asenine egotist you are. You don't understand the basis of the tools you are using.
    There are very good reason's why 1. kernal programming, 2. embedded systems, 3. low level devices are done in C and not C++.
    Java will one day surplant C++ as the standard OO design platform and not a day too soon. When that happens, C will still be used widely for many tasks which are unsuited to Java.
    If you don't understand these basic issues, then I recommend you go back to Visual Basic programming and leave the system programming to people with more brains than you have.
  • Listen up C++ programs!

    Do this in C++...

    Cross platform/compiler. No real standard, no real cross platorm=no real widespread usage for cross platform work.

    'nuff said.

    :)

    -Alan
  • C++ is a SUPERSET of C. Everything a wannabe hippster C++ programmer might learn from this book WILL APPLY DIRECTLY TO C++.

    I use C++ and/or Java every day. You can bet I'll read this book sooner or later to make myself a better programmer in languages based on C (including Objective-C, for all you NeXT/Mac types out there).

    Sokwuitcherbichin!
  • I agree that a more accurate title for Perry's
    book would be `Intermediate C Programming', but
    your distinctly rabid sentiments are wide of the
    mark.

    Deep C Secrets is a book that I mean to check out
    at some point, but I was a little less than
    enamoured with van der Linden's `Just Java' book.
    It offers a lot of very good insights into Java,
    but is lacking in example code.

    As an aside, the classic view that C can *only* be
    learnt from KnR II is a little suspect. It is
    a great introductory text, and an even better
    reference for C syntax, but it is a little too
    bare bones for a standalone C tutorial.
  • If you've know a bit of C (or C++, it doesn't matter), you know that
    C++ means "C grows larger, but result is as before". If Stroustroup had really intended
    to build general replacement for C, not a language
    which works better than C in _particular_ areas,
    he'd call it ++C
  • See:
    apache - is written on C
    Emacs - written on Lisp (so its way for OO programs)
    Linux kernel - written on C
    Gimp - written on C.
    Perl - written on C
    Tcl - written on C

    So, where are good programs written on C++?
    Nothing to name except KDE. But there is a lot
    of problems with it. Is there web-servers war?
    No - anyone prefer to contribute to apache.
    But there is Desktop war, becouse too much people
    don't like either Qt or C++ at all and starting
    altertaitve desktop projects.

    Consider number of programmers who would be
    able to peer review and contribute to your code.
    If you write in C every C _and_ C++ programmer
    counts. If you write in C++, there are a lot
    of people (and, more imprtant, compiliers)
    who wouldn't understand what are you trying to
    say.
  • People might like to check out Van Der Linden's "Expert C Programming (Deep C Secrets)" - it's a very odd book, full of many random snippets, but it does contain some nuggets of useful wisdom.

    Thanks for the review - I'll have a look for this book next time are out shopping...

    Cheers,

    Andrew

  • I mean, I know some good programmers that are forced to use VisualBasic; doesn't make visual basic any better than the horrid excuse for a scripting language that it is.

    I know some poor coders who try to code in C; doesn't make C a poor language.

  • by GypC (7592)
    C++ is dumb... needlessly complex. ObjectiveC is much nicer.
  • "Rescued By: Core Teach Yourself Zen and the Art of Advanced C Programming for C and C++ Programmers by Example for Dummies in a Nutshell Unleashed in 24 Hours for the Complete Idiot in 7 Days
  • i'd take a closer look at the nitwits in redmond before laying the blame on c++. true, c++ extends c to facilitate object oriented programming. a simulation? alright, i'll give you that; but it's quick and backward compatible and that ain't bad.
  • I always use http://www.acses.com to search online bookstores. It is a book search engine which tells you the price of a book with shipping included.

    If you are looking for computer books look at http://www.bookpool.com. They are not indexed by acses.com, but they usually the cheapest and often out-of-stock.

    Other new bookstores that seem promising:
    http://www.shopping.com
    http://www.buybooks.com (buycomp.com rocks!)

    Never use amazon.com and barnesandnoble.com. They often lie about their selection (sure we have that in stock! oops, please wait 5 weeks)
  • The ultimate guide to C has got to be K&R. No one should be allowed to program C without it. Read it. Live it. Love it.

    And if you need the linked-list-hash-table-b-tree stuff get a good algorithms book. I have heard Sedgewick (?) has written some good ones for C and C++.
  • How can your learn C++ without learning C, when C is a subset of C++?
  • Man, I wish I was on top of the tech-wave like you are, ya know? Wait, lemme try...

    "They should have a book on Shockwave instead!"

    "They should have a book on JavaBeans instead!"

    ...whoa! If I'm ignorant and spout gay-ass buzzwords, then I'm cool! This is SOOO cool. I can't wait to tell my mom.

    (Not saying C++ is bad or anything, but I am saying that straight-up C coding is a man's language.. Heheh)


  • IMHO it's not true.
    Programming language is the tool or instrument only. It can't be dumb.
    But programmer (usually not a real programmer) can. And don't forget that the C++ is only preprocessor for pure C... I think that mindless plastic box (even 450 MHz with) can't be smarter than man's brain...
  • What Inefficincies in perticular are you refferring to????

    Quite frankly I LOVE C!

Some people carve careers, others chisel them.

Working...