Friday, February 17, 2012

My Errata for C Programming in easy steps 3rd edition: article 201201

C Programming in easy steps 3rd edition
Author: Mike McGrath
Published by Easy Steps Limited

I think this book’s format is a great way for a beginner to wade into C programming however, even on its third edition there are several typos both in the verbiage and examples. I saw this as a challenge because it forced me to really investigate and understand the code in the examples.  Others may see this as a frustration and deter them from using the book.  Because I like the book so much, especially its lack of “fluff” and it’s great format I promote it to others, with the caveat that there are many typos.   I have yet to find errata on the web so I thought I would help my friends and peers out by listing errors and corrections out myself and maybe Easy Steps will throw another book my way (like maybe Java 4th edition, or SQL or both…)

So here I go:

Page 33 in step 2 of the example last line of the code snippet
Reads: double decimal = 0.123459;
Should Read: double decimal = 0.1234569;

Page 48 in step 2 of the example (there should be a space between DEBUG and 1
Reads: #define DEBUG1
Should Read: #define DEGUG 1

Page 65 the entire example is off.   The author is trying to get from x= 10 to y = 5 using XOR to flip bits to have x=5 and y=10; however, coding and running the example as presented ends with x=15 and y=5.  The typo is found in step 3 the last line in the comment section:
Reads: /*1111 ^ 1010 = 0101 (decimal 5)*/
Should Read (based on XOR, the numbers provided, and how the code is written): /*1010 ^ 0101 = 1111 (decimal 15)*/
So this is a combo of a typo and inaccurate coding.
The output in the image should have the second line of x= and y= as such
Reads: x=5 y=10
Should Read: x=15 y=5

Page 75 in step 2 the line of code has misplaced left curly bracket
Reads: int num = 2 ; char letter = ‘b’;  }
Should Read: int num = 2 ; char letter = ‘b’; 

Page 76 in Step 2 the line of code has a misplaced left curly bracket
Reads: int I, j; }
Should Read: int I, j; 

Page 141 in step there is a period where a comma should be
Reads: file_ptr = fopen( “data.txt” . “w”) ;
Should Read:  file_ptr = fopen( “data.txt” , “w”) ;

Page 144 in step 1 there in an include file string.h complete missing; it is needed call strcpy
Reads:  #include
Should Read:  #include

That is all I came across, at least that I notated as I read the book.  Of course there could be more in the books verbiage and appendix etc… I did complete every example given in the book and they worked, eventually, so I believe I have caught all of those.  I hope this helps and I hope a 4th edition is printed with corrections because I really do believe it is a great beginner’s book.