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.
Version |
Location |
Description |
Submitted by |
Date Submitted |
PDF |
Page 134
code block |
fgets stores a newline character at the end of the string, causing the strstr comparison to fail.
|
Sarin Tonin |
Feb 18, 2024 |
Printed, PDF |
Page 81
upper left post-it |
Note says:
"ints are different sizes on different machines"
Should say:
"pointers are different sizes on different machines "
|
Julius |
Feb 14, 2023 |
PDF |
Page Chapter 11, Page 478
3rd line from the bottom |
The call s[c-1] = '\0'; Does not replace the '\r' with 0, it replaces the '\n' with 0.
|
Ricardo Brambila |
Sep 10, 2022 |
PDF |
Page NA
215 |
Oreilly have moved all the "Head First" scripts and examples under one unbrella repository: https://resources.oreilly.com/examples
..however... See: https://resources.oreilly.com/examples?utf8=%E2%9C%93&filter=head+first+c
ALL of the repos for "Head First C" contain examples from another book. It appears whomever administers the repo naming, is not aware "C" and "csharp" are different languages.
And there is no way to file an issue or PR against typos in a repo name. :-(
It would be lovely if O'Reilly would refresh Head First C content - it's a classic but now 12 years on the 1st Edition.
|
Anonymous |
Aug 13, 2022 |
Printed |
Page 186
everywhere |
The exercise for `message_hidden.c` `encrypt()` which re-declares a POSIX system function of the same name, which is silently imported via `stdio.h` (seems a secondary import of stdio.h or it's imports).
This means IF you forget to supply "encrypt.c" with the gcc command (or, cough cough, you used an IDE without a Makefile) then the system function will be in scope. You will not get any compiler warning, and the resulting binary silently fails it's function (no text output).
If there's ever a Second Edition, suggest renaming this exercise to use a function name that's not in scope elsewhere, perhaps `obfuscate()`.
|
Scott Prive |
Aug 13, 2022 |
Printed |
Page 115
Actually it's the existing errata for the map page |
Problems:
While the 2015 errata corrects the changed map URL, that explanation as a remedy will not work in 2022 with a modern browser.
I made some progress, but have not solved it yet.
1) Browsers want to save the page as 'Head First C Map.html' with data in 'Head First C Map' and spaces make a mess of things (at least on macOS)
2. Once the webpage is saved locally (even using a save name with no spaces), the page will load but will not respond. Focus is frozen to whatever GPS point you selected prior to the save, and you can't click focus on any of the markers. The downloaded version \map\output.json does not do anything (you can try deleting it and reloading the page but the points remain).
Other things I tried:
* instantiating a web server in my save directory, the saved page just feels "static" and you can't click on the map or markers.
* Made progress, download using wget (with resource download flags) gets you a page that can be clicked on (speech bubbles on markers, etc). Try this:
wget -r -np -k (then URL to dogfriffiths page... form won't let me include any links...)
UNFORTUNATELY it still hardcodes the markers from the page save.
(I even tried standing up a webserver, replacing the downloaded output..json with a modified version having only 3 points data, start webserver (or file>open), then opening the page in a different browser, but : the page still shows the original points. Not my reduced point set.
I'll live, but FYI. It seems like the maps page can't function when saved local.
|
Scott Prive |
Jul 23, 2022 |
PDF |
Page 30
diagram of the foor loop example |
Under the heading "...and the for loop makes this easy", there is a diagram explaining the structure of the for loop. It states "This is the text condition checked before the loop runs each time." It should say "test condition", not "text condition".
|
Eric Bishop |
Sep 12, 2021 |
Printed |
Page 146
146 |
First Edition printing of 2012
Program run is missing the `./` to run the program, it looks like it should be:
./categorize UFO aliens.csv Elvis elvises.csv the_rest.csv
|
ABDULLAH Budri |
Oct 24, 2020 |
PDF |
Page 13
1 line, 3 column |
Q: Are there any differences between string literals and character arrays? A: Only one: string literals are constant.
But using this code I got not bus error but changed string array "Saatner" in both declarations (char txt[]="Shatner"; and char txt[8]={'S','h','a','t','n','e','r'};):
mass.c:
#include <stdio.h>
#include <stdlib.h>
int main(){
//char txt[]="Shatner";
//char txt[8]={'S','h','a','t','n','e','r'};
//char txt[8]={'S','h','a','t','n','e','r','r'};//where \0 code was added? don't understand...
//txt = "Shatner";
//txt = {'S','h','a','t','n','e','r'};
txt[1]='a';
printf("Txt=%s\n",txt);
printf("Txt[8]=%i\n",txt[8]);
return 0;
}
user@user-lenovo:~/dta/lang/clang/griffits$ gcc mass.c -o mass && ./mass
Txt=Saatner
Txt[8]=0
user@user-lenovo:~/dta/lang/clang/griffits$ gcc mass.c -o mass && ./mass
Txt=Saatner
Txt[8]=0
gcc --version
gcc (Ubuntu 9.3.0-13ubuntu1) 9.3.0
|
Vyacheslav Badmatsyrenov |
Jul 24, 2020 |
PDF |
Page 12
2nd paragraph |
I used those lines for example in my other c file:
s = "Shatner"
s = {'S', 'h', 'a', 't', 'n', 'e', 'r'}
- this lines invokes gcc compile errors:
error: assignment to expression with array type
5 | txt="Shatner";
error: expected expression before ‘{’ token
6 | txt={'S','h','a','t','n','e','r'};
So i used internet for these declarations:
char txt[8]={'S','h','a','t','n','e','r'};
char txt[]="Shatner";
gcc --version
gcc (Ubuntu 9.3.0-13ubuntu1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
Vyacheslav Badmatsyrenov |
Jul 24, 2020 |
PDF |
Page 75
First point |
In the case of string literal initialization of a character array variable. Memory only created for the array variable, not for both array variable and string constant.
|
NAVEEN SANAPATHI |
Jun 18, 2020 |
PDF |
Page 322
Function "int arts_theater_or_dining (char *s) |
The condition "arts" is moot as art is always listed singular (i.e. "art") in the ADS array of strings. If we were to look for "art", then Peter would be available in the search results.
|
Marc-Alexandre Camirand |
Apr 30, 2020 |
PDF |
Page 239 - 240
"Sharpen Your Pencil" exercise at bottom of page |
Solution to Problem Requires Use of Unknown Information:
This exercise asks us to fill in the correct variables the function should call:
"void happy_birthday(turtle *t)
{
___.age = ___.age + 1;
printf("Happy Birthday %s! You are now %i years old!\n",
___.name, ___.age);
}"
It then proceeds to give us an answer on the following page. That answer required the use of a notation we haven't been taught yet, for reasons we don't know yet. The correct answer required us to answer:
"(*t).age" and "(*t).name"
...for the missing variables. However, most readers would assume the answers are:
"*t.age" and "*t.name"
...at this point, because we *haven't yet been taught* about using parentheses for pointers to struct fields. That information doesn't appear until *after* this exercise, in the section following it on page 240.
Books should not be providing exercises to a reader if the answers to those exercises cannot reasonably be known by the reader. Because the answers to these exercises required information not yet given, they should have been presented after, and not before, being taught about using parentheses for struct field pointers.
|
Franz |
Apr 24, 2020 |
PDF |
Page 231
Top of the page (data set and Question 0) |
The book provides the data set:
"Name: Snappy
Species: Piranha
Food ingredients: meat
Food weight: 0.2 lbs
Exercise description: swim in the jacuzzi
Exercise duration 7.5 hours"
...and then answers the question of how to define the data for the struct in question as:
"struct fish snappy = {“Snappy”, “Piranha”, 69, 4, {{“meat”, 0.2}, {“swim in the jacuzzi”, 7.5}}};"
The problem is that the teeth (69) and age (4) of "snappy" have been provided in the struct definition, but not in the supplied data set.
Because no values had been provided, I was expecting to see what method would be used to address definitions for fields in structs where there is no data. I had personally assumed that we would have to define those values as NULL by using a formation such as...:
"struct fish snappy = {“Snappy”, “Piranha”, '\0', '\0', {{“meat”, 0.2}, {“swim in the jacuzzi”, 7.5}}};"
...which was an assumption I made based on the fact that we can't "skip" a field in our definition, or we'll be placing the wrong kind of data in the wrong fields and the program will overflow the buffers. Because we weren't given for age and teeth in this data set (even if they were known from previous examples, they were not provided in the data set for this exercise), if we simply skipped them and gave the values for the nested structs, the 'age' and 'teeth' variables would almost certainly overflow and data wouldn't be stored as expected.
This presented an interesting dilemma, which I decided could be solved by placing NULL values in the fields for our unknown integers 'age' and 'teeth'. However, instead of addressing this question, the book raises it, and then ignores it in the answer.
This would be a good opportunity to address how structs being defined with fields with unknown values need to have those values defined, in order to prevent misplaced variables and buffer overflows.
This is a minor quibble, I suppose, but it was a little jarring to see the book raise an interesting technical question that hadn't been explored yet, only to subsequently continue as though the question hadn't been raised and to answer the question using data that wasn't provided in the data set for said question.
|
Franz |
Apr 23, 2020 |
PDF |
Page 185
Entry 4: "Linking it all together" |
There is a sentence here that is so grammatically ambiguous as to be indecipherable.
"The compiler will connect the code in one piece of object code that
calls a function in another piece of object code"
The verb "connect" is ditransitive. It requires two objects to be meaningful - the thing (object one) being connected, and the thing (object 2) to which it is being connected. An expected construction would take the form of:
"(The connector) (will connect) (the thing) to (the widget)."
Subject, verb phrase, object, preposition, object.
The sentence, as it appears in the text, is so ambiguous that it cannot be properly interpreted as it is currently written.
"(The compiler) (will connect) (the code in one piece of object code that calls a function in another piece of object code)."
Subject, verb phrase, object. The preposition and second object are absent in this interpretation, which is syntactically valid, even if the resulting clause becomes incomplete.
It is possible to parse this differently:
"(The compiler) (will connect) (the code in one piece of object code that calls a function) in (another piece of object code)."
or
"(The compiler) (will connect) (the code) in (one piece of object code that calls a function in another piece of object code)."
Subject, verb phrase, object, preposition, object.
The use of the preposition "in" contributes to the confusion. One would generally expect the preposition "to" where "connect" takes two objects.
The resulting ambiguity prevents the reader from confidently drawing a certain conclusion about an important technical aspect of object code linking. While it appears clear that the third possible syntactic configuration was not intended, it is still a possible interpretation.
I had to stop and read this sentence many times while going through the text, and am still in no way sure that I have derived the intended meaning.
I would suggest that the author or editor review this sentence to see if it can be rewritten. It should be possible to reduce the ambiguity, and therefore increase the clarity and precision, of the concept being conveyed.
|
Franz |
Apr 21, 2020 |
Printed |
Page 386
third column, answer to second question |
The answer to the second question says that static linking makes the executable small, fast, and easier to move.
I think small is not true: with static linking, the library code is included in the executable.
I am not sure about fast: do you mean runtime after loading? In that case, I would not expect much difference one way or the other.
I hope this is helpful!
|
Allen Downey |
Mar 31, 2020 |
PDF |
Page 26
Case 12: |
The code:
switch(train) {
...
Case 12:
winnings = winnings + 20
...
}
The issue:
The arrow with the caption states "If the train == 12 then just add 25 to the winnings." But the code states it only adds 20 (winnings + 20).
Thanks
|
Anonymous |
Oct 02, 2019 |
PDF |
Page 24
Example C |
The "Be the Compiler Solution" Example C seems to describe a result which I cannot replicate. The answer states "The code compiles. The program displays "Ace!" and is properly written".
Now I'm not very versed in C but when compiling the code myself the result is not "Ace!" rather "Small card". Does the indentation change the flow of code execution (like python)? I am running gcc/Apple LLVM v 10.0.0 (clang-1000.10.44.4)
The code in question.
#include <stdio.h>
int main()
{
int card = 1;
if (card > 1)
card = card - 1;
if (card < 7)
puts("Small card");
else {
puts("Ace!");
}
return 0;
}
Thank you
|
Anonymous |
Oct 02, 2019 |
PDF |
Page 389
C Lab 2: OpenCV |
Proposed OpenCV lab is impossible to accomplish - OpenCV now represents C++ interface instead of Pure C. Even in tutorial of OpenCV there are couple of unfamiliar concepts.
|
Anton |
Nov 29, 2018 |
Printed |
Page 322,323
The function "int arts_theater_or_dining" |
The problem statement on page 321 asked to find someone who likes the arts, theater, or dining.
The sample array ADS has all the candidates as liking "art", but the solution code on page 322 uses strstr to look for "arts" (which would match no candidates).
The solution code should use 'strstr("art")' and the final solution for find(arts_theater_or_dining) should have the following 6 outputs: William, Matt, Luis, Peter, Josh, and Jed.
|
Tarry Chen |
Feb 25, 2018 |
Printed, PDF |
Page 111-112
Missing Info |
Book talks about redirection operator for standard input and standard output using "<" and ">" respectively. But it seems book didn't clarify that those operators wouldn't work on PowerShell. So, the command "./geotojson < gpsdata.csv > output.json" in a Linux Terminal should be changed into "Get-Content gpsdata.csv | .\geo2json | tee output.json" to work on Powershell.
A note: tee command outputs on the commandline and creates a file at the same time. I am not a Powershell expert and use Linux as my main OS. There might be a better option than tee command for creating an output file.
|
Uğur Ali Kaplan |
Jan 31, 2018 |
Printed |
Page 94
code example |
In the printed edition of the book the scanf function is used to get the search string. I think use scanf is not the right function to use in this example because at page 68 is told that scanf takes the input until it find a whitespace. That means if the input is for example 2 words, the search string search_for contains only the the first word. So I think use of fgets is the right solution.
|
Martin Jansen |
Aug 19, 2017 |
Printed |
Page 94
code example |
In the printed edition of the book the scanf function is used to get the search string. I think use scanf is not the right function to use in this example because at page 68 is told that scanf takes the input until it find a whitespace. That means if the input is for example 2 words, the search string search_for contains only the the first word. So I think use of fgets is the right solution.
|
Martin Jansen |
Aug 19, 2017 |
Printed |
Page 478
int read_in(...) function's code |
Dear Sir and Madam,
I use your book with great pleasure and great benefits as a basis to create a tcp server and client (e.g. an echo server/client -> server repeating everything the client say like a parrot :-) ).
I took the decision to write my own client (instead of using telnet) while relying on your web client as a basis (I had used your code for a tcp server as a basis first and it was working really great!).
However, my client wasn't working with my server, while telnet was working... I looked quite a long time to see where was the issue. In fact, it lies in the server code of "read_in (...)". Indeed, if the code of "read_in( )" in chapter 11 is very slightly completed/changed, the server you proposed can work not only for telnet, but also for other home-made clients :-) For this reason, I take the liberty of indicating it to you. In order to make your server "read_in( ...)" function compatible with more clients, one should just complete the following line code:
while((c > 0) && (s[c-1] != '\n')) { ...
by
while((c > 0) && (s[c-1] != '\n') && s[c-1] != '\r') { ...
I just hope that this could prevent other readers to face a problem similar to mine, whereas the content of this chapter is otherwise so great and so helpful! (sockets and networking are very rarely treated in books on C).
A great thank you for your book and your work!!! I'm learning Computing Science at University and it helped (and still helps) me a lot!
Jean-Roch Lauper (Switzerland)
|
Jean-Roch Lauper |
May 05, 2017 |
Printed |
Page 455
"What's my Purpose?" section |
Please disregard my other errata. I am stupid.
|
Dalton Martins |
Mar 13, 2017 |
Printed |
Page 455
"What's my Purpose?" section |
Descriptions of the signals are changed.
|
Dalton Martins |
Mar 13, 2017 |
Printed |
Page 455
"What's my Purpose?" section |
In the Book, the description about the SIGQUIT signal says it is sent when "Terminal window changed size".
But the GNU C Library says:
"The SIGQUIT signal is similar to SIGINT, except that it’s controlled by a different key—the QUIT character, usually C-\—and produces a core dump when it terminates the process, just like a program error signal. You can think of this as a program error condition “detected” by the user. (...)"
http://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html
|
Dalton Martins |
Mar 13, 2017 |
Printed |
Page 61
Bottom |
In the 'Sharpen your pencil' box, the arrow detailing where the print needs to begin should be pointing to the 'c' in "call", not the a.
|
Kendra T. |
Feb 12, 2017 |
PDF |
Page 400
Code Magnets Solution |
In windows with MinGW the solution don't solve the problem, because is necesary remove "\n" at the end of the fgets() and asctime():
int main()
{
char comment[80];
char cmd[120];
char * timestring = NULL; // initialize local variables
fgets(comment, 80, stdin);
comment[ strlen(comment) -1] = 0; // reomve the trailing \n taken by fgtes()
timestring = now();
timestring[strlen(timestring)-1] = 0; // remove the \n from ctime()
sprintf(cmd,"echo '%s %s' >> reports.log", comment, timestring);
system(cmd);
return 0;
}
It works now !!!
|
Andres Londoño |
Nov 01, 2016 |
PDF |
Page 400
Code Magnets Solution |
In windows with MinGW the solution don't solve the problem, because is necesary remove "" at the end of the fgets() and asctime():
int main()
{
char comment[80];
char cmd[120];
char * timestring = NULL; // initialize local variables
fgets(comment, 80, stdin);
comment[ strlen(comment) -1] = 0; // reomve the trailing \n taken by fgtes()
timestring = now();
timestring[strlen(timestring)-1] = 0; // remove the \n from ctime()
sprintf(cmd,"echo '%s %s' >> reports.log", comment, timestring);
system(cmd);
return 0;
}
It works now !!!
|
Andres Londoño |
Nov 01, 2016 |
PDF |
Page 92
Line 6 of solution |
The solution is supposed to print the song number with:
printf("Track %i: '%s'\n", i, tracks[i]);
It is not usual to start counting songs in a playlist with zero-based counting, so to get the correct song number add +1 to the value returned in the printf:
printf("Track %i: '%s'\n", i+1, tracks[i]);
|
Anonymous |
Jul 27, 2016 |
Printed |
Page 91/93/94
Bottom left function (page 91/93) & the main function in the page 94 code review |
The same erroneous code appears in all three places.
1: int main()
2: {
3: char search_for [80];
4: printf ("Search for: ");
5: scanf ("%79", search_for);
6: search_for [ strlen(search_for) - 1 = '\0' ];
7: find_track (search_for);
8: return 0;
9: }
Using this code as the main function in the program on page 94 and entering for example the string "my" will return a result as if the user had entered only "m". The program will search for a string one char shorter then the one the user entered.
The problem is line 6 in the current program. It replaces the last character entered by the user with the '\0' (null) character. After reading the confirmed errata it seems like this piece of code (in the first printing of the book) used fgets() on line 5 instead of scanf().
As i understand it the fgets function adds a newline char ('\n') automatically to the end of the string the user enters. Line 6 in the current code was intended to overwrite this newline char with the NULL char. But since scanf() does not add a newline char the result is that the last character in the string the user entered is overwritten instead. If line 6 is omitted the program works as intended.
|
Gustav Bergstrand |
Jul 29, 2015 |
PDF |
Page 483
while loop of main function |
when comparing the string received from the client, strncasecmp() is used incorrectly
example:
if (strncasecmp("Who's there?", buf, 12))
should be
if (strncasecmp(buf, "Who's there?", 12) != 0)
since strncasecmp() returns 0 if the given "strings" are equal, ignoring case, and the given integer gives a limit for the first string not the second.
|
Anonymous |
Jun 08, 2015 |
PDF |
Page 497
Paragraph "Send signals with raise()" |
"Sometimes you might want a process to send a signal to itself,
which you can do with the raise() command" should be changed into
Sometimes you might want a process to send a signal to itself,
which you can do with the raise() FUNCTION.
|
Paolo Piersanti |
Mar 25, 2015 |
PDF |
Page 493
middle of the page |
"The sigaction() function will return –1 if it fails and will also
set the errno function" should be corrected into "The sigaction() function will return –1 if it fails and will also set the errno VARIABLE"
|
Paolo Piersanti |
Mar 24, 2015 |
PDF |
Page 167
Example |
Book says:
printf("The value of FLT_MIN is %.50f\n", FLT_MIN);
This is the lowest value.
No it is not, this is:
printf("The value of FLT_MIN is %.5f\n", -FLT_MAX);
|
Koray Tugay |
Mar 19, 2015 |
Printed, PDF |
Page 163
2nd Example |
Example is:
int x = 100000;
short y = x;
print("The value of y = %hi\n", y);
It should be printf not print.
|
Koray Tugay |
Mar 19, 2015 |
Printed |
Page 93
Top left function and top right function |
On page 93 the mistakes in the top left and top right functions are mentioned by the authors, but there is no comment for the following line:
search_for[strlen(search_for) - 1] = '\0';
I assume this line was added to null terminate the search_for string, but the string has already been null terminated by the previous line (fgets()).
If the search_for string is not null terminated, strlen() can not be run on it since it requires there to already be a null terminator in the string. Running strlen() on a string that is not null terminated could cause strlen to run outside the allocated array until it accidentally hits a 0 somewhere in memory. For example I tried running strlen() on a "string" of length 2 that was not null terminated and in my debugger it reported the length as 20.
Furthermore, it is incorrect to subtract 1 from the result of strlen(). Let us assume that we have the following null terminated string:
['A', 'B', 'C', '\0']
strlen() on this string would give 3 since strlen() does not include the null terminator. Subtracting 1 from this result would give 2. But adding a null terminator to index 2 would overwrite 'C'. That is probably not the intention?
|
Erlend Andreas Lorentzen |
Feb 08, 2015 |
Printed |
Page 93
Bottom left function |
The bottom left function on page 91/93 has several errors / faulty assumptions. One of these are already mentioned in the unconfirmed errata.
The code in question is as follows:
==========================
char search_for[80]; // line 1
printf("Search for: "); // line 2
scanf("%79s", search_for); // line 3
search_for[strlen(search_for) - 1] = '\0'; // line 4
find_track(search_for); // line 5
return 0; // line 6
==========================
First of all, line 4 is not needed since scanf adds a null terminator at the end of the string automatically. But even if scanf did not add a null terminator, this code would not work since search_for[80] has not been initialized and contains "garbage" and is not a valid C-string until a null terminator is added. If there was no null terminator added, strlen(search_for) would not work, because it relies on there being a null terminator in the string in order to check the length and that would make the effort of adding a null terminator pointless. But even if it worked without the null terminator this would still not give the correct behavior, since it overwrites the last string character with a null terminator, not the last array position. You are using strlen as if it was sizeof. But strlen does not include the null terminator it is the length of the string not the size of the array:
If we assume that a string of length 79 was written to the search_for array so that index 0 through 78 corresponded to a valid character (and index 79 being the final index position where one would add a null terminator), then:
strlen(search_for) - 1 => 79 -1 => 78 (index of null terminator)
But index 78 is occupied by a valid character. Index 79 would be the first array index after the last valid character and it would make sense to add a null terminator there if scanf did not add a null terminator.
|
Erlend Andreas Lorentzen |
Feb 08, 2015 |
PDF |
Page 93
bottom left function |
The latest version of the ebook prints the following
scanf("%79s", search_for);
search_for[strlen(search_for) - 1] = '\0'
The above line is not necessary to add a null char since we are using scanf operator.
|
Ng Peng Hon |
Jan 20, 2015 |
PDF |
Page 37
Check if card val is in range |
The proposed check is:
if ((val < 1) || (val > 10))
printf("I don't understand that value")
but in the switch above it we have:
case 'A'
val = 11;
which means the card counter claims it doesn't understand Aces as input.
Suggest changing case 'A' such that val = 1.
|
Grahame Gardiner |
Jan 17, 2015 |
Printed |
Page 664
7th line of text from the top of page including title. |
Incomplete sentence (look at the words "items" and "And":
"...The only difference is that instead of laying out items And just like the ListView, it uses a"
|
Shannon Boggs |
Dec 09, 2014 |
PDF |
Page 88
Sharpen your pencil answer |
This solutions shows:
strstr()
it should show:
strstr() and strlen()
|
Anonymous |
Oct 19, 2014 |
PDF |
Page 37
End of the while condition of Exercise Solution |
The while condition reads:
} while(card_name[0] != 'X')
It's missing the ; at the end of the line. It should read:
} while(card_name[0] != 'X');
|
Anonymous |
Oct 19, 2014 |
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); |
|
Jean Doyon |
Oct 24, 2013 |
|
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 |
|
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 |
|
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 |
|
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 |