Computer Science: A Structured Programming Approach Using C. Third Edition.

Behrouz A. Forouzan and Richard F. Gilberg

Course Technology

(ISBN: 0-534-49132-4)

This document contains errata for the text. Status in the table below indicates the print run that contains the correction: 0 indicates that the problem has been reported but not yet corrected, 1 indicates that the errata was corrected in the first printing, and so forth.

Status / Page / Subject / Correction
3 / 9 / Footnote / Change "There are no identifiers..." to "There are no labels...
3 / 10 / 4th Paragraph / Change "C is..." to read "C, with its standard libraries, is considered..."
3 / 11 / Figure 1-10 / Line 1 in Program: Delete space between stdio. and h>
Last box, change "Runner" to "Loader"
3 / 30 / Last Paragraph / Delete "...and added the concept of data types." from 7th line.
3 / 45 / Figure 2-12 / First line on left, change lower-case’b’ to upper-case’B’
3 / 53 / Program 2-3 / In line 16, change "...PI);" to "...cPI):"
3 / 61 / Example 12 / First print position in second example should be “+0002.30”
3 / 66 / Example 1 / First line insert "if there were" after "Note that"
insert a comma after "z"
insert "it" before "would"
delete comma after "error"
so it reads
"Note that if there were a space...z, it would create an error"
3 / 101 / Cast Operator / In blue box, change to read: "(float) x"
3 / 102 / Box at top / Delete last example in blue box at top of page [“(2 + 3 * 1)…7 * I”]
3 / 109 / Figure 3-8 / Align asterisks (2x) with rest of text
3 / 110 / Figure 3-9 / In green box, align *=
In yellow box, align -=
3 / 118 / Line 8 / Change "now" (third word) to "not"
3 / 145 / Problem 33 / In formula, change (100 / 180) to (100.0 / 180.0)
3 / 157 / Program 4-2 / Line 17 should not be highlighted. Delete yellow background
Lline 18 should be highlighted. Add yellow background
3 / 178 / 6th Full Paragraph / Change "date" to "data" so it reads "The asterisk...not data variables"
3 / 189 / Floor Functions / Function names are wrong. Change "float" to "floor" in second column of all three rows so it reads
double floor (...
float floorf (...
long double floorl (...
3 / 195 / Program 4-10 / Line 13: Delete comment (// Seed temporally)
3 / 201 / Figure 4-33 / Move shadow in "Add" rectangle to the right
3 / 225 / Problem 34 / In second sentence, change “three” to “four”, change comma after functions to a semicolon, and insert “main” (italics) so it reads:
“…Use four functions: main, one to read…”
3 / 236 / Figure 5-4 / Change title to "Relational and Equality Operators"
1 / 239 / Figure 5-8 / First line: change -- to == so it reads "if (i == 3)"
3 / 240 / Blue box at top / Delete "else" and align the print statement to the left.
3 / 256 / Line 2 at top / Change "types" to "constants" so it reads
C integral constants. For every...
3 / 297 / Problem 56 / Line 7. Change "sum" to "value" so it reads "} // if value"
3 / 311 / Program 6-1 / Line 5 Add: turnOffAirCond() after semicolon.
Line 7 Add: turnOffHeater() after semicolon. Align with line 5
3 / 314 / Program 6-3 / In Results: Add a period after stop in second line.
3 / 317 / Paragraph 2 / Change’C’ at beginning of paragraph to’C99’
Change "previous" in second line to "next" so it reads
"done in the...in the next example."
3 / 323 / The Comma... / Last line first paragraph: Change "expression" to operator twice so it reads: "...operator has the lowest priority of all operators,..."
3 / 340 / Figure 6-21 / Change arrow line in for statement to point to expr3.
3 / 343 / Powers / Line 4: xn should be xn
3 / 345 / Highlight Note / First line: change to read "...initialize the result (a variable named largest) to a very small..."
Third line: change to read: "...initialize the result (a variable named smallest) to a vary large..."
3 / 348 / Third Blue Box / Change fourth line to "result = result & number > 0;"
3 / 356 / Last sentence / First line: Delete "obvious"
Second line: delete " for more than 20 numbers".
3 / 366 / Linear Loops / in for statement: insert a space between "i="
delete space in "i ++"
3 / 367 / Second paragraph / At end of line 1, change "a factor" to "the limit test in the for loop."
so it reads
"In both cases, ... proportionate to the limit test in the for loop."
Delete next sentence: “The higher…numer of loops.”
3 / 384 / Problem 44 / Delete "a list of the numbers followed by" in the second line.
3 / 395 / Streams / Line 2: change "is" to "are" so it reads "as we...2, data are input..."
3 / 396 / Closing the Stream / delete last line "and destroy the contents of the file"
3 / 398 / File Open... / 4th Line from bottom: insert "file" between "the name" so it reads "dows system, the file name..."
Delete "up...with" and insert "a name, a dot (period), and" so it reads "dows system, the file name consists of a name, a dot (period), and a three-character"
1 / 399 / Figure 7-3 / Remove extra line through top of disk token
3 / 401 / Code at Bottom / 6th line: change "spData" to "spTemp" so it reads
"spTemp = fopen..."
3 / 406 / Figure 7-5 / In lower, blue box on left, insert "# Alternate" below "0 zero..."
3 / 407 / Table 7-3 / In the four rows at the bottom (real) change the first double to "float" and add "long" before the third double so they all read:
none (float), l (double), L (long double)
This change should also be made to the top figure in the inside back cover.
3 / 419 / Table 7-4 / In rows 5 - 8 (real) change the first double to "float" and add "long" before the third double so they all read:
none (float), l (double), L (long double)
This change should also be made to the bottom figure in the inside back cover.
3 / 420 / Table 7-5 / Formatting box in last row: change "scientific" to "real"
3 / 421 / Conversion Codes / in Real (f), after "Chapter 2." add "If the precision is 0, the decimal point is printed only if the alternate flag (#) is also present."
3 / 425 / Program 7-3 / Line 16: Change to "if (spIn!= NULL)
3 / 434 / Read a Character / 4th line: Insert after “occurs.”
“We discuss how to tell the difference in Chapter 13.”
3 / 436 / Program 7-7 / Line 19: Change “P07.07.DAT” to “P07-07.DAT”
3 / 462 / First sentence / Change "scores1" to "scores0"
Change "scores[1]" to "scores[0]
Change "scores19" to "scores9"
Change "scores[19] to "scores[9]
3 / 463 / Figure 8-6 / Add one more entry at bottom of array:
scores[9] then blue box with data 16
Draw line from Elements oval to new entry
3 / 463 / Second Paragraph / Line 3: insert "introduced in C99," so it reads "program is...In a variable-length array, introduced in C99, the size..."
3 / 464 / Figure 8-7 / In top entry in figure, change [9] to [10] and add new blue box at end. Label new box "[9]"
3 / 464 / Accessing Elements / Last example: change "9," to "10;" (change number and change comma to semicolon.
3 / 466 / First blue box / Change "9" to "10" so it reads: "for (... i < 10; i++)
3 / 467 / Second blue box / Change "9" to "10" so it reads: "for (... i < 10; i++)
3 / 484 / Program 8-7 / Delete lines 53 and 54.
Line 60, change expression after & to "dataIn < range"
3 / 493 / Top of Page / Delete "Program 8-9 Analysis"
Note: Do not delete "Program 8-9 Analysis" at end of program.
3 / 497 / Figure 8-26 / In left flowchart, on leftmost arrow, add box containing
list[walker + 1]
= temp
3 / 508 / Figure 8-33 / Change "Sequential" to "Binary" in top oval.
3 / 516 / Figure 8-37 / Top program, line 4: make "int" blue text
Bottom program, line 4: make "printf" blue text
3 / 538 / Blue Box / Third line, change "// Invalid" to "// Poor Style
3 / 538 / Summary / Fourth Bullet (Initialization...): Change "an array" to "a fixed length array"
3 / 581 / Figure 9-22 / Last line: remove & so it reads "pa = a; // Error Different levels
3 / 583 / Figure 9-23 / Line 3 from bottom: remove & so it reads
pa = a; // Invalid: different level
3 / 596 / Last sentence / Change "systems" to "applications" so it reads
"ity to move data between applications, such..."
3 / 614 / Figure 10-4 / In display, change second line from "2 4" to "4 4"
3 / 631 / Reallocation of Memory / blue box at end: move asterisk to left so it reads
void* realloc...
3 / 632 / Figure 10-17 / Make background of text "10 integers" white not gray
3 / 647
648 / "Dynamic Memory..." / Delete this section because it is now obsolete. Virtually all computers now correctly handle memory deletion.
3 / 681 / First Paragraph / Delete first sentence: "The easy...scan set."
Delete fourth and fifth sentences: "The scan set...alphabetical character."
Before last sentence, insert: We read the first and last names using the string conversion code."
After last sentence, insert: "As an alternative, we could have used the scan-set conversion code, but it is simpler to use the basic string code (remember KISS)."
1 / 690 / Section 11.5 / First paragraph, last sentence. Change "w4e" to "we"
3 / 691 / String Length / Move "strlen" before "returns" so it reads "...function, strlen, returns..."
3 / 697 / Second Paragraph / Start of last sentence: Change "This" to "Using an extra element"
3 / 704 / Figure 11-22 / Change "ptr" to "pToken" in (b), (c), and (d)
1 / 713 / Figure 11-24 / Remove extraneous (straight) line on right of figure.
3 / 750 / Third blue box / Change "enum color" to "enum myColor"
Note: keep alignment of RED, BLUE, and GREEN
3 / 750 / Next Paragraph / Line 1: change "ROSE" to "RED in color (see page 747)"
3 / 750 / Anonymous Enumeration: / Add at end of sentence beginning with "As another example..."
"Anonymous enumeration cannot be used to declare a variable."
3 / 775 / Figure 12-17 / In function header, add return type "int"
3 / 784 / First Paragraph / Insert after "Figure 12-21." "Note that in the figure, un is the member name to access the union structure."
3 / 788 / Last Paragraph / In second line, delete ", such as the Macintosh,"
Change "index 3" to "index 0"
3 / 809 / Question 12 / Delete second sentence: "Variables cannot be created at the same time."
3 / 814 / Question 32 / After "Figure 12-29." in last paragraph, add "Zero is considered positive."
3 / 818 / Question 42 / Last line, delete " in a 13x3x4 matrix"
3 / 823 / Differences... / #3 in first set, change "is" to "may be" so it reads "There may be a..."
#3 in second set, change "is" to may be" so it reads "there may be an"
3 / 828 / Figure 13-7 / 1. Make red pointer box 50% color
2. Make sure red line starts in the center of the red box
3 / 830 / Figure 13-8 / 1. Make red pointer box 50% color
2. Make sure red line starts in the center of the red box
3 / 831 / Figure 13-9 / 1. Make red pointer box 50% color
2. Make sure red line starts in the center of the red box
3 / 832 / Figure 13-10 / 1. Make red pointer box 50% color
2. Make sure red line starts in the center of the red box
3 / 835 / Figure 13-12 / Add an ellipse (...) between the last two green boxes on right.
3 / 882 / First Paragraph / Line 6, insert after "(4 Bytes). Beginning with C99,
1 / 885 / Program 14-3 / Line 1. "or" overflows. Delete "This program" and start demonstrates with upper case.
1 / 888 / Program 14-5 / Line 1 overflow. Move "one’s" to beginning of line 2 and delete empty line
1 / 889 / Program 14-5 / In line 14 delete "// 0 for sender"
In line 15 delete "// value for receiver"
In line 29, make "while" blue text
3 / 889 / Shift Operators / In line 4, change "system" to "compiler" so it reads
"tion of the software engineer who designs the compiler. It...
1 / 891 / Program 14-6 / Four lines overflow.
21. Move "bitStr" to new line 22 and align under "O" in Original.
25. Move "bitStr" to new line 27 and align under "S" in Shifted.
29. Move "bitStr" to new line 32 and align under "S" in Shifted.
33. Move "bitStr" to new line 37 and align under "S" in Shifted.
3 / 891 / Program 14-6 / Line 48. Move "0X001 +" to new line 53 and align under open paren in "(char)
1 / 893 / Program 14-7 / Line 9: make "include" blue text
3 / 894 / Rotation / Paragraph 2, line 2. Change "right" to "left" so it reads
"the other end...we shift them off the left end..."
Paragraph 2, line 3: Change "left" to "right" in two places to read
"value...on the right. When we..., we shift off the right"
Paragraph 2, line 4, change "right" to "left" so it reads,
"end and insert them on the left. Figure..."
3 / 894 / Figure 14-4 / First line, change "Left" to "Right"
Line under first rectangle, change "left" to "right"
Line under second rectangle, change "right" to "left"
Last line, change "Right" to "Left"
3 / 894 / Last sentence / Change "left" at end of first line to "right"
Last line: change "right" to "left"
3 / 895 / First paragraph / Line 1: end of line, delete "it is easy"
Line 2: Beginning of line, delete "to code"
Insert in place of deleted text "the rotations can be coded" so it reads
"Although...left or right, the rotations can be coded using..."
3 / 895 / Second paragraph / Change "shift" to "rotate" so it reads "The rotate left operation..."
3 / 895 / Program 14-8 / Line 30: change "rotate16Right" to "rotate16Left"
3 / 896 / Program 14-8 / Line 33: change "rotate16Right" to "rotate16Left"
Line 38: change left to right so it reads "Post:...bits right"
Line 40: Change "rotate16Left" to "rotate16Right"
Line 43: Change "rotate16Left" to "rotate16Right"
Results: Change third line to read "Rotated Left: 0X3452
Change fourth line to read" "Rotated Right: 0X5234
3 / 896 / Creating Masks / Line 3: change "0x8031" to "0x8101" and "flags" to "masks" so it reads: "stant 0x8101. dynamic masks are created..."
1 / 897 / Second Blue Box / Make "define" blue text (3 times)
1 / 899 / Program 14-9 / Line 24 overflow. Add number (25) to following line and align "&comAddr[10]" under "&comAddr[3] in line 24
Rest of line numbers should automatically renumber.
1 / 900 / Program 14-9 / Lines 58 and 66 overflow. Add line numbers and align code as explained in 899 above.
1 / 901 / Program 14-10 / line 9: make "void" blue text
3 / 902 / Program 14-10 / Line 57 overflow.
Create new line 58. align "comAddr[1] under "comAddr[3]
Add space after comma so "comAddr[0] aligns on "comAddr[2]
Line 66: Make "return" blue text
1 / 924 / Alpha List / a. change "integers" (last word) to "blocks"
b. change "integer" (2 times) to "block"
3 / 929 / Nodes / Make style header3 (same as "Pointers..." on next page
3 / 984 / top of page / Line 4 & 5: Delete "When we discuss...key sequence."
3 / 1059 / Appendix F / List flows in columns through the four pages rather than the customary flow from the bottom of column1 to the top of column 2 on each page.
3 / 1091 / First sentence / Change "All" (first word) to "In all..."
Insert "main" (italic type) between "have" and "coded"
3 / 1095 / Appendix I Title / Make’V’ in "Void" lower case.
Make "void" italic.

10/17/18Page 1