C by Dissection, Edition 4

by Al Kelley and Ira Pohl  

Addison-Wesley ISBN 0-201-71374-8

This significantly revised edition has been carefully designed to meet the needs of readers new to C. The reader moves easily through the fundamentals of C and on to its latest applications by means of a time-tested explanatory tool called dissection, first developed by the authors in 1984. Dissection, a pedagogical method similar to a structured, step-by-step walk-through, explains new programming elements and idioms as they are encountered in working code. Right from the start, the authors introduce the reader to complete programs, and at an early point in the text the reader learns to write functions, an important feature of structured programming.

Features

You can buy this book online through Barnes and Noble. Ira also has a general course outline for an Introductory Computer Science course with C as its base language.

The C code examples in the book are available in several forms. The code is arranged in directories corresponding to the chapters of the book. To get to the unpacked version for any system, or to get individual program files, you can use the FTP directory (www.cse.ucsc.edu/~pohl/CBD4/). Files are also available in zip form for Windows users and compressed tar form for UNIX users.


Errata

p1 (Bruce Dang) line -8 C for C++ Programmers should instead be C++ for C Programmers.


p19 (Bruce Dang) lines 10-11 The line break is incorrect on the output.

Change

Input your three initials and your age: CBD 19 Greetings 
C.B.D. Next year your age will be 20.
 
To:
Input your three initials and your age: CBD 19
Greetings C.B.D. Next year your age will be 20.

p31 (Bruce Dang) The program is not formatted properly. First,  int main ... needs to be at the margin. 
Second, C++ should use // comment form.  The program should look like this: 
// This is the "Hello, world!" program in C++.
// Note the use of endl to create a newline.
#include <iostream.h>
int main() { cout << "Hello, world!" << endl; return 0; // this is optional }

p56 (Kurt Nørmark) Assignment Table is missing the /= operator on the second line


p105 (Fred Gooding) T


p115 (Kurt Nørmark) exercise 2 There is no variable d. Change the expression a > b && c < d to a > b && c < x


p129 (Bruce Dang) line -1: Change "... parameters is used in the body... " to "...parameters are used in the body of..."


p147-150 (Kurt Nørmark) heads_or_tails program

The heads_or_tails program at the website does not correspond to the one in the book. Also, the filename prn.c is reserved on some systems and therefore cannot be used as the filename for the print instructions part of the program on page 149.

The heads_or_tails program has been replaced with the appropriate code in the uncompressed portion of the website. It is available in

http://www.cse.ucsc.edu/~pohl/CBD4/ch04/07_heads_or_tails/

Also note that prn.c was changed to prn1.c to comply with file naming conventions.


p165 (Bruce Dang) exercise 10 The hailstone sequence is expressed improperly. Change it so that it reads as follows:


p176 in the cartoon use single quote around first A.

From: AND "A" IS NOT THE SAME AS "A"!

To: AND 'A' IS NOT THE SAME AS "A"! ---


p257 (Kurt Nørmark) exercise 1 "If dec is passed as an argument to the function, jan should be returned" should read "If jan is passed as an argument to the function, dec should be returned"


p287 (Kurt Nørmark) line -1 char p should be replaced with char *p


p314 (Kurt Nørmark) The Elements of array a[] does not show the passes correctly Replace the Elements of an array [a] table with the following

Unordered data 7 3 66 3 -5 22 -77 2
First pass -77 7 3 66 3 -5 22 2
Second pass -77 -5 7 3 66 3 2 22
Third pass -77 -5 2 7 3 66 3 22
Fourth pass -77 -5 2 3 7 3 66 22
Fifth pass -77 -5 2 3 3 7 22 66
Sixth pass -77 -5 2 3 3 7 22 66
Seventh pass -77 -5 2 3 3 7 22 66


p326 line 8: There is too much white space to the left of the word "new" in the phrase "In C++, new is used..."


p342 (Kurt Nørmark) The illustration of C. B. Diligent\0 is missing has the count as 13 1 15. It should read 13 14 15.


p396 (Kurt Nørmark) line -4 The word "operatiors" should be "operators"


p424 (Kurt Nørmark) Exercise 1. The line structure food { should be struct food {