REVIEW - Teach Yourself C in 21 Days (5ed) (with Visual C++ 6.0)

Title:

Teach Yourself C in 21 Days (5ed) (with Visual C++ 6.0)

Author:

Aitkin&Jones

ISBN:

0672317672

Publisher:

Sams ()

Pages:

750pp&CD

Reviewer:

Yechiel M. Kimchi

Reviewed:

October 2000

Rating:

★☆☆☆☆

The title of the book is obviously false; I am still waiting to meet the inexperienced programmer that is able to effectively acquire the knowledge of a new non-trivial programming language in just a few weeks. Nevertheless, the content of a book with such a title may still be satisfactory. In this case, it is not. In fact, it seems to be the worst book on C I have ever seen. (I have seen worse, but they were on C++.) I do not want to go into fine details, so I shall give some general remarks, seasoned with a few examples.

  1. The authors do not care about ANSI-C: Their deviations from the standard start with many cases where
    main()
    returns
    void
    and culminating when they do not distinguish between standard and non-standard library functions.
  2. The book advocates a bad and dangerous, coding style (in general, most of my students write better code); functions are way too long (e.g., 90 lines), algorithms are primitive in the worst possible sense and I have stopped counting the cases where global variables were used (with not even a superficial benefit). Regarding the latter, here is a quotation from one of the book's DO-boxes (p. 293): 'DO pass data items as function parameters instead of declaring them as global if they're needed in only a few functions.' [hope springs eternal :-]
  3. Code examples have bugs:
    1. When it has
      main()
      that returns type
      int
      , there are many cases where the return statement has no expression to
      return
      (e.g., pp. 419, 443, 478, 479, 481, 483 :-).
    2. Among several cases that I have seen, where dynamically allocated memory was used, only in one case was there code for freeing the memory allocated.
    3. Given the definition
      char input[80], *ptr;

      here is the control expression of a while loop, p. 238:
      while ( *(ptr = gets(input)) != NULL )
      It is not only the case that input may overflow, but this code compiles only if
      NULL
      is
      #defined
      to be 0. Had
      NULL
      been defined to be
      (void*)0
      (which is a common practice), this code would not have been compiled. All in all, it shows that the writer does not distinguish between
      NULL
      and
      '\0'
      .
    4. p. 417: 'Here's the code to delete the first element in a linked list:
      free(head); head = head->next;
      For the novices; it is forbidden to use
      head->next
      after
      head
      was freed.
  4. If 21 days is not enough for you, you get a Bonus Week - seven chapters about OOP. I shall skip the nonsense that is spread all over and give a simple hint; on p. 644 it tells the interested reader to purchase other books on C++, yet the only book that is mentioned by title is - you guessed right - Sams Teach Yourself C++ in 21 Days . You might guess what was the only reason they had not mentioned Stroustrup's book.
  5. Appendix D refers to portability issues, so I hoped that at least here they would be careful - I was wrong. Read this pearl, taken from p. 782: Regarding order of members in a structure, they say: There isn't a standard stating that a certain order must be followed. Alas, Kernighan&Ritchie disagree, K&R2 p. 213: The members of a structure have addresses increasing in the order of their declarations.
On top of all these, the examples are boring and dull - mainly in the line of 'enter some input - get it slightly modified as the output'.

The bottom-line; keep a safe distance from this book. This book is a time-bomb, waiting to blow up your programs.


Book cover image courtesy of Open Library.