Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am looking for a good C book. What can you recommend as I am need of another language beside perl. Thank you very much.

Replies are listed 'Best First'.
Re: C Book you can recommend
by Old_Gray_Bear (Bishop) on Dec 07, 2005 at 17:22 UTC
    K&R (The C Programming Language), of course. And "Lyon's Commentary om UNIX 6th Edition with Source Code.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: C Book you can recommend
by kirbyk (Friar) on Dec 07, 2005 at 17:32 UTC
    In addition to the definitive Kernighan and Ritchie, I like O'Reilly's Practical C Programming.

    (I got my copy of K&R used for $1 at a Safeway in Portland while getting food for a con. I really can't explain why they had a pile of almost-free used books, or why K&R C was among them. Just one of those mildly weird things that happens from time to time.)

    -- Kirby, WhitePages.com

      Just to go a bit more offtopic here, but Safeway often has used books that are "donated" by whomever wants to get rid of books, and the proceeds will go to the charity chosen by the employees in that store on a year-by-year basis (i.e., they choose one per year).

      If you're lucky, you can find gems. Either way, the money goes to charity.

      I second the Practical C suggestion; the old-school one with the cow on the cover, and the line at the top saying "When does 2+2 = 4094?"*

      *or some similar number...
Re: C Book you can recommend
by marto (Cardinal) on Dec 07, 2005 at 17:24 UTC

      I'd disagree and say it's marginally off topic. Having a strong C background made picking up Perl a snap, and it's a very good thing to have to understand the *NIX / POSIX underpinnings which Perl sits on top of. Not to mention if you ever want to interact with external libraries via XS or Inline::C.

        On the other hand, having a strong C background makes you program perl as if it were C. When I'm recruiting for perl people, I ask that applicants be competent with some other language, but I don't care what language.

        That said, I'll second both K&R (2nd edition) and The Joy Of C. Both are very good.

        I agree that a systems programming language like C would complement Perl well; small overlap in their problem areas.

        (Strictly commercially today, Java might be a better choice. I don't know.)

        If you are going to learn C, I would recommend spending a few hours looking over processor architecture, if you don't know anything about it. C is quite close to the machine and it is enlightening to think about how C code would compile.

        I am impressed by your will to learn. I know fewer languages after learning Perl! I stopped using AWK, shell and others and can't say I know them anymore. I know a better superset.

        My favorite C book is Harbinson-Steele, but it is not that relevant anymore. Go with K&R or some other recommendation.

Re: C Book you can recommend
by swampyankee (Parson) on Dec 07, 2005 at 17:25 UTC

    Gehani, N, C:  An Advanced Introduction, Computer Science Press, Rockville, MD: 1989

Re: C Book you can recommend
by venk (Acolyte) on Dec 08, 2005 at 13:30 UTC
    Expert C Programming by Peter van der Linden is an entertaining second book on C. You might want to have a look at it after you finish K&R
      Thank you all for your advice.
Re: C Book you can recommend
by Fletch (Bishop) on Dec 07, 2005 at 18:15 UTC

    I had a first or second edition copy of A Book On C by Al Kelley, Ira Pohl (ISBN 0201183994) which was pretty good (actually I originally picked up C from a Waite Group quick reference, but this book was used as a text in the intro to C class I took aeons ago). Be aware that it's more aimed at a "know how to program and want to pick up C" audience than non-programmers.