Departments
|
C All-in-one Desk ReferencePage 43-44 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 printed in the book needs to be changed to a forward slash in your code. Page 51 Second to last paragraph, (bottom left in the box), should read, "The bottom line is that it takes more work for the computer to figure out floating point problems than it does for the computer to work in integers." Page 74 At the end of the first diamond bullet, it should say atoi not atio. Think "A toy." In the bottom paragraph, the "Tip," the fourth sentence should read, "Sometimes this strategy makes the code less readable for beginners, but it often improves readability for those more experienced in C." Page 76 The code for scanf("%s",subname); An ampersand is not needed before a string variable name in the scanf() function. Later on the same page, I write, "The variable must be prefixed by an ampersand." That's technical incorrect. Arrays don't need the ampersand prefix. It doesn't screw anything up by adding them, but the statement I wrote implies something else. Bottom line: for strings or arrays, there is no need to prefix them with a (Also see the entry for pages 365 and 366.) The To fix the program, add a new line below the variable declarations and above the first puts() statement: total = 0; Page 120 The line at the bottom of the page should read "The += mathematical shortcut . . ." I have it backwards at =+, which isn't correct. Page 121 The source code demonstrates multiplying a variable by a value and then having the result placed back into the same variable. It doesn't not demonstrate multiplying a varible by its own value. Page 130 The result of an operation such as Page 132 Modify line 13 to read like this: if(agent==7 && (code=='B' || code=='b')) This modification ensures that the first two items (7 and B) aren't compared first, which they would be given the order of precedence. The hex code for the Yen character (¥) is Page 156 In the paragraph before the Base 8, or octal heading, the reference should be to Appendix B, not Appendix C. Page 161 The third to last paragraph should reference exercise 2.2.4. Page 197 The definition for #define OMEGA ('Z' - '@') The @ symbol has an ASCII value one less than 'A' (64 versus 65), so the end result is that all 26 letters of the alphabet will be produced by the code. Page 212 The if(a > b) Page 219-220 The source code listed in the section Where http://www.c-for-dummies.com/source.code/middle/grid1.c Page 239 At the end of the three dimensional array, the value 108 shouldn't have a trailing comma. That could cause problems. Page 242 In the first two bullets, the variable b should be variable ball. Page 247 The last sentence before the section The Truth About Strings should read, "Before that, you have to understand that a string variable in C isn't a variable at all." The word "string" was omitted; string variables are actually character arrays. Page 252 In the third paragraph, the word Page 288 The sample output of Wizard of Oz Database! Actor Age Role ---------------------------------------- Judy Garland 17 Dorothy Ray Bolger 35 Scarecrow Bert Lahr 44 Cowardly Lion Jack Haley 40 Tin Woodsman Frank Morgan 49 The Wizard Margaret Hamilton 37 Wicked Witch Page 308 The source code for the modification to the Feel free to delete the Page 312 Last line, the variable c need not be declared; it's not used in the code. Page 343 The scanf() statement is missing a scanf("%d",&you.inches); The two printf() statements at the end of the program use the printf("You are %.1f centimeters tall.\n",you.centimeters); Note that the code found here does list the correct expressions. Page 356 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 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 359 The 11th line of the code should read: kilometers = miles*KPM; Page 365 The sidebar at the bottom of the page, "If you don't need an Page 366 In the second paragraph, the parenthetical statement is incorrect. You do not need to use an Page 367 Line 6 in the code should read: short int *pa; Obviously if Page 393 Line 11 in the code should read: upper >>= 8; There is a space between the Page 407 The sentence in the middle of the page should reference pointer variable
Page 408 This sentence is incorrect:
The *p part of the operator is bound more tightly than the ++, as described (correctly) in Table 4-1. Page 440 In Figure 6-5, the *(*(array+0)+0) notation above bashful\0 is repeated. It should instead read *(*(array+0)+0), *(*(array+0)+1), *(*(array+0)+2), and so on. Page 443 In Table 6-1, the last entry is incorrect. The 1 should be replaced with the letter a, like this: **(array+a)+b is the same as array[a][0]+b which translates as the value of the first item in the array referenced by a, plus the value of b. Note that b is not used to calculate an address, but rather it's added to the value found at the address. Page 468 The solution for Exercise 4.7.4 is wrong. See the entry for Page 739. Page 459 The second bullet point should read variable Page 504 Some versions of GCC recognize select() as an existing function and it is! It's used for "synchronous 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 void bselect(void); And in void bselect(void) You do not need change the name of Page 536 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 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 If you're using Mac OS X, then the stat() function appears to return zero for the file size in the printf("File size is %lld bytes\n",fbuf.st_size); (Those are lower case L characters, not ones, in the placeholder.) Page 626 The sample code was copied improperly. It should read Page 644 The chunk of text needs to be inserted after the Page 673 Step 2 is different for Windows 2000, which uses a 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
I apologize for this confusion; it's been a long time since I had a Windows 2000 computer to play around on. Page 690 First line of code at the top of the page is not needed. It's a relic from the original program; the variable Page 696 The answer for Exercise 1.8.3 ( printf("Traveling at %d kph, ",SPEED); Page 738 Line 11 in the code should read: showArray(primes,elements); I forgot to update the code to include the proper reference to variable elements. The answer for Exercise 4.7.4 didn't include the ugly
Copyright © 1997-2012 by QPBC. |