I read the book The Practice of Programming and worked all the exercises.
bzr get http://www.bamsoftware.com/bzr/tpop-answers
to
get a revision control copy, if you have an unseemly interest in all my
revisions and changes.I bought the book shortly after it was published in 1999, on sort of a whim after reading a Slashdot review. I don't think I even read the whole book. I didn't appreciate at the time how much it had shaped my programming style. One thing that sticks in my mind is this technique for getting the number of elements in an array:
#define NELEMS(a) (sizeof(a) / sizeof(a[0]))That alone was worth the price.
Doing all the exercises was challenging! It took me 10 months, with several spacious breaks. I think it was harder than The C Programming Language. The exercises in the first chapter are there to trick you into thinking the rest will be as easy. Here are a few difficult ones:
printf
,
using as many mechanical aids as possible.match
and grep
to work with UTF-8 strings of Unicode characters.These solutions are dedicated to waffle, the 120 MHz Fujitsu Lifebook laptop computer on which I did almost all the work.