Head First C

Errata for Head First C

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.


Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted
PDF Page 274
Program Output

The output from the code void display(island *start){ island *i = start; for(; i != NULL; i = i->next){ printf("Name: %s open: %s-%s\n", i->name, i->opens, i->closes); } } displayed on Page 275 is missing a \n between %s and open:

Bill  Sep 06, 2014 
Printed Page 465
Bottom, Bullet Points section, 5th bullet point

5th bullet point should have signal() replaced by sigaction() as that has been the method demonstrated for changing/registering the new handler for a signal in the preceding pages. Point should read: "Handlers can be replaced with the sigaction() function"

Frank Hernandez  Jul 28, 2014 
Printed Page 445
Bottom, "parent" graphic caption

Parent graphic caption should read: 'The parent connects the read end to the Standard Input' (instead of Standard 'Output'). Parent descriptor table graphic correctly shows the 'Standard Input' as being effected by dup2(fd[0], 0); statement. Caption needs to be corrected to 'Standard Input'

Frank Hernandez  Jul 25, 2014 
PDF Page 548
7th paragraph

The variable, "$@", is duplicated in the sentence describing the example make task. The second instance of "$@" should be "$^". It should read: "Then, the recipe will run a gcc command to create the target fred (given by the special symbol $@) using the given dependency (given by $^."

Jeff Ramnani  Jul 21, 2014 
PDF Page 215
Last line

The books states: "If you have a Mac and want to make your plant really talk, you can download a script from the Head First Labs website that will read out the stream of serial data: www.headfirstlabs.com/books/hfc" However, that link does not work: "Page Not Found Sorry, that page does not exist."

Sarah  Jul 07, 2014 
PDF Page 113
map.htlm

v2 API no longer available

Anonymous  Jun 24, 2014 
Printed Page 12
To the bottom right

C coders after call this the NULL character should be C coders often call this the NULL character

Deepu Thomas  Jun 09, 2014 
PDF Page 69
Heading-Anyone for three-card monte?

You were saying that the code would give an error while it was compiling but on my machine it compiled successfull and also with desired output. What is the reason please clarify me I running windows 8. and using Developer command prompt for vs 2012 for compiling c programs.

Nasim Royal Beg  Jun 03, 2014 
PDF Page 4
scanf("%19s", ex);

Missing &

Jean Doyon  Oct 24, 2013 
Safari Books Online 375
Under 'Compiling the elliptical program'

I also noticed that the first command says \include where it should say ./includes (dot, forward slash, and with an s at the end).

Linda Pescatore  Sep 21, 2013 
Safari Books Online 375
Under 'Compiling the elliptical program'

Again, there is no dot before the slash in the statements. I am not sure whether this is intentional but it does say the code is the same as before, and the previous code for static linking had the dot.. Also, why switching to back slashes when before we used forward slashes?

Linda Pescatore  Sep 21, 2013 
Safari Books Online 374
code after first paragraph

The line gcc -I/includes -fPIC -c hfcal.c -o hfcal.o lacks a dot before /includes. The code may work depending on how someone's files are set up. The previous example about static linking did use the dot there. Or, there should be instructions to move the includes directory if that was the intent.

Linda Pescatore  Sep 21, 2013 
PDF Page 322
United States

In the arrays, one of the "likes" is "art." I'm not sure if it's intentional but the function "int arts_theater_or_dining" searches for a match with "arts." Peter likes art, but he is not found in this search, although he probably should be.

Linda Pescatore  Sep 12, 2013 
Printed Page 331
compare_names function

A "better" solution for the compare_names() function: int compare_names(const void* a, const void* b) { char* str_a = *(char **)a; char* str_b = *(char **)b; return (strcmp(str_a, str_b)); } as this version does not require the additional dereference, and more closely resembles the previous solutions. I would then move the annotation, "We need to use the * operator to find the actual strings", to point to the * operator in the right hand operand in the first line.

Patrick Waugh, M.A.  Aug 27, 2013 
PDF Page 200
United States

I think that this mistake hasn't been caught because we readers don't see the thruster and launch files to try and make a makefile for. But I tried making a makefile for my encrypt.c and file_hider.c files (the latter I made myself, it's the other program that would use the encrypt file). I followed the template on page 200, and wondered why it didn't work. It only did the first command. I found http://www.cs.umd.edu/class/fall2002/cmsc214/Tutorial/makefile.html by googling and realized the targets were in the wrong order. The make file should only complete the first command, so the final target has to be first, not last. The launch rule must come first, then launch.o, then thruster.o. When I reordered my makefile, it worked great.

Linda Pescatore  Aug 27, 2013 
PDF Page 182
United States

Not sure if this is a cygwin issue, but it didn't happen when i tried the example in linux. The message_hider doesn't respond with the encryption after each line is input, unless you add this after main: setbuf(stdout, NULL); I already had the \n to \0 substitution but it wasn't enough.

Anonymous  Aug 25, 2013 
PDF Page 111
United States

I found the solution to the error I posted before about the ragged formatting, well actually someone at Stack Overflow figured it out. Because I created the .csv file on Windows, Cygwin and Linux didn't like my line endings. I added \r before \n in the scanf parameters and it straightened itself out.

Linda Pescatore  Aug 22, 2013 
PDF Page 111
United States

I copied geo2json and gpsdata.csv exactly from the book. Geo2json works fine with data from keyboard but when I redirect stdin to the file, something strange happens at the beginning of each line except the last. I am using Cygwin. $ ./geo2json < gpsdata.csv data=[ '}, itude: 42.363400, longitude: -71.098465, info: 'Speed = 21 '}, itude: 42.363327, longitude: -71.097588, info: 'Speed = 23 '}, itude: 42.363255, longitude: -71.096710, info: 'Speed = 17 '}, itude: 42.363182, longitude: -71.095833, info: 'Speed = 22 '}, itude: 42.363110, longitude: -71.094955, info: 'Speed = 14 '}, itude: 42.363037, longitude: -71.094078, info: 'Speed = 16 '}, itude: 42.362965, longitude: -71.093201, info: 'Speed = 18 '}, itude: 42.362892, longitude: -71.092323, info: 'Speed = 22 '}, itude: 42.362820, longitude: -71.091446, info: 'Speed = 17 '}, itude: 42.362747, longitude: -71.090569, info: 'Speed = 23 '}, itude: 42.362675, longitude: -71.089691, info: 'Speed = 14 '}, itude: 42.362602, longitude: -71.088814, info: 'Speed = 19 '}, itude: 42.362530, longitude: -71.087936, info: 'Speed = 16 '}, itude: 42.362457, longitude: -71.087059, info: 'Speed = 16 {latitude: 42.362385, longitude: -71.086182, info: 'Speed = 21'} ]

Linda Pescatore  Aug 21, 2013 
PDF Page 527
third paragraph, "Events"

"fires her canyon" should be "fires her cannon"

David Demko  Jun 14, 2013 
Safari Books Online 366
2nd code snippet

"#include <stdio.h>" could be removed because the main function doesn't use any I/O function.

Thomas Corbière  Aug 18, 2012 
PDF Page 96

It would be helpful to have a link to the GPS csv data available for the examples in Chapter 3.

Anonymous  Feb 26, 2012