errata

Departments

Main

About

Errata

FAQ

Compiler Tips

Supplemental Lessons

NCurses

Source Code Files

On-line Book Ordering

[C News]

Errors. Typos. Problems. Omissions. And stuff like that.

Common issues:


Generally Speaking...

  • Note that filenames are listed in ALL CAPS in the book, which is merely a style convention. Remember that Linux, FreeBSD, Mac OS X or any Unix uses case sensitive filenames. So if you type in a filename as ALL CAPS you must refer to it as such throughout the development process.
  • Yes, I recognize that the # is known as the hash in Britain. The book's localizer should have caught that one. In America, # is the pound symbol. In the U.K., £ is the pound symbol.
  • Check the FAQ for information on fpurge()...

C for Dummies, 2nd Edition

Page 51, reported Aug 27, 2004

Note that COLOR is also a Win2000 command, and that command runs before your COLOR.EXE program does. To solve this, run your COLOR program from the command prompt in this manner:

.\color

Just as in Unix, if you specify the program file's location, it runs from that location. In this case, .\ specifies the current directly, so that your COLOR command runs instead of the Windows COLOR command.

Page 96, reported August 2007

The last word in the first paragraph on the page should be number not letter. Try not to use a number as the first letter of a variable name.

Page 366, reported March 4, 2007

The directory name for Dev-C++ is listed incorrectly. It should be C:\Dev-C++ not C:\Dev=C++.

C All-in-one Desk Reference

Page 43-44, reported February 2005

At the top of page 43 the fifth line of code should read:

print("Hello, geek!/n")

That same line is repeated at the top of page 44, where it should read:

printf("Hello, geek!/n");

In both cases, the backslash needs to be changed to a forward slash.

Page 101, reported on October 2004

The TICKETS.C program uses the total variable without first initializing it. On some systems, this has the effect of producing an invalid result. This is my problem; using a variable without initializing it is wrong. Sometimes it does work, but there is no guarantee. (Refer to pages 53 & 54 in the book.)

To fix the program, add a new line below the variable declarations and above the first puts() statement:

total = 0;

Page 130, reported September 2007

The result of an operation such as a=b is not "always TRUE" as it says in the box. It could be TRUE or FALSE. The result depends on the value of b, which is assigned to a and evaluated by if. So when b is non-zero, the result is TRUE. When b is zero, the result is FALSE. Regardless, the point made in the sidebar is correct: you need two equal signs to compare values, not one.

Page 132, reported April 2007

Modify link 13 to read like this:

if(agent==7 && (code=='B' || code=='b'))

Page 155, reported December 2004

The hex code for the Yen character (¥) is 0x9D, not 0x9E as listed in the text.

Page 211, reported December 2004

The ff at the bottom of the page is supposed to be if, as in:

if(a > b)
    z = a;
else
    z = b;

Page 219-220, reported January 2005

The source code listed in the section Where goto Is Perhaps Needed, is missing the updates mentioned in the text. The code is listed properly in this web site's source code area:

http://www.c-for-dummies.com/source.code/middle/grid1.c

Page 288, reported August 2006

The sample output of OZ.C (oz7.c on disk) is incorrect. The output shown is what the list looks like before the swap. After the swap, the output should look like this:

Wizard of Oz Database!

Actor Age Role
----------------------------------------
Judy Garland 17 Dorothy
Ray Bolger 35 Scarecrow
Margaret Hamilton 37 Wicked Witch
Jack Haley 40 Tin Woodsman
Bert Lahr 44 Cowardly Lion
Frank Morgan 49 The Wizard

Page 308, reported January 2005

The source code for the modification to the MYSTUFF.C program includes the declaration of the input[] variable, but that variable is not used in the code. This is also true for the source listing on page 309 as well.

Feel free to delete the input[] declaration. Though the program runs with it in there, it's wasteful of resources.

Page 343, reported April 2005 and October 2007

The scanf() statement is mising a & before the you.inches variable. It should read:

scanf("%d",&you.inches);

The two printf() statements at the end of the program use the %f placeholder incorrectly. They should read, both in the code and later on toward the end of the page:

printf("You are %.1f centimeters tall.\n",you.centimeters);
printf("Paul is %.1f centimeters tall.\n",paul.centimeters);

Note that the code found here does list the correct expressions.

Page 350, reported March 2005

The 11th line of the code should read:

kilometers = miles*KPM;

Page 356, reported June 2005

Near the end of the code a capital I appears where a little i should be used instead. At the end of the code, the end of the line just before return(0) should be &temp[i];

Incidentally, many professors recommend that you not use I alone as a variable name for this reason, as well as that I is often confused with the number 1.

Page 367, reported February 2006

Line 6 in the code should read:

short int *pa;

Obviously if *pa is to reference the short int array they most be of the same type.

Page 407, reported February 2006

The sentence in the middle of the page should reference pointer variable c and not p:

This type of construction shouldn't be entirely alien to you. You should recognize that *c is a pointer, which means that c contains a memory address.

Page 504, reported March 2005

Some versions of GCC recognize select() as an existing function — and it is! It's used for "synchronus I/O multiplexing" (whatever that is). So with some compilers you may need to rename the select() function as listed on page 504 in the main() function. I recommend using bselect() instead:

bselect();

On page 505 in LOTTO.H:

void bselect(void);

And in SELECT.C on page 507:

void bselect(void)

You do not need change the name of SELECT.C, only the name of the function select().

Page 536, reported July 2007

My editor got a bit overzealous when correcting the PigLatin program's output. Each word is Initial Caps in the output. The output should read:

Something clever
Omthingsay Levercay

If you'd like to have the code keep the same case as the input text, then feel free to make that modification on your own!

Page 587, reported August 2007

If you're using Mac OS X, then the stat() function appears to return zero for the file size in the FILEINFO.C program. This is because OS X stores the file size in a double-long int. When you use %d to display the value, it probably shows zero because of the way a double-long is stored in memory. Use %lld instead:

printf("File size is %lld bytes\n",fbuf.st_size);

(Those are lower case L characters, not ones, in the placeholder.)

Page 626, reported January 2008

The sample code was copied improperly. It should read index++; not index--; as shown in the middle of the page.

Page 644, reported February 2008

The chunk of text needs to be inserted after the while(ch != 'Q') statement. The statement mentioned in the book is while(ch != 0), which is incorrect.

Page 673, reported September 2004

Step 2 is different for Windows 2000, which uses a local documents folder as the main personal file storage thingy. So use this command instead:

cd "local documents"

(The double quotes are not optional.)

You'll then see the prompt reflect this:

C:\Local Documents>

Thanks to reader Cort for pointing this out. Also, reader James notes that a My Documents folder can be found, though it's location is:

Documents and Settings\Administrator\My Documents

I apologize for this confusion; it's been a long time since I had a Windows 2000 computer to play around on.

Page 696, reported August 2005

The answer for Exercise 1.8.3 (MOON4.C) uses the wrong placeholder to display the value of the SPEED constant. The %d placeholder should be used instead of %f. Line 14 in the source code should read:

printf("Traveling at %d kph, ",SPEED);