The introduction to On To C follows. Additional information about this book, along with access to software, is available via http://www.ai.mit.edu/people/phw/Books/

How On To C Teaches You C

The purpose of this book is to help you learn the essentials of C programming. In this section, you learn why you should know C and how this book is organized.
Early versions of the Unix operating system were written in a language named B, which was based, in part, on a language named BCPL. The implementers of Unix then developed another, better language, based on their experience with B. They decided to name that new language C inasmuch as it superseded B.
Today, just about all computers are organized around bits, bytes, and collections of bytes. Instruction sets vary greatly, however. Accordingly, C allows you to refer to bits, bytes, and collections of bytes explicitly, but C does not allow you to specify computer-specific instructions. Instead, your computer-independent, higher-level function descriptions are translated for you into sequences of computer-specific instructions.
Assembler languages allow you to specify functions at the level of computer-specific instructions, which operate on memory chunks of various sizes. Thus, programs written in assembler languages are not portable. C, by contrast, allows you to specify sequences of computer-independent, conceptual instructions, which operate on memory chunks of various sizes. Thus, programs written in C are portable. By encouraging you to think in terms of memory chunks, yet discouraging you from thinking in terms of computer-specific instructions, C provides a sensible tradeoff, enabling you to write programs that are both fast and portable. Accordingly, C is sometimes called a portable assembler language.
C has became popular by virtue of attractive characteristics, such as the following:
There are two principal reasons to learn C: Also, because C is so widely used, you often hear programmers debate the merits of other languages in terms of their advantages and disadvantages relative to C.
Four principles determined this introductory book's organization and style:
To get you up and running in C quickly, the sections in this book generally supply you with the most useful approach to each programming need, be it to display characters on your screen, to define a new function, or to read data from a file.
To answer your basic questions explicitly, this book is divided into parts that generally focus on one issue, which is plainly announced in the title of the section. Accordingly, you see titles such as the following:
To encourage you to develop a personal library of solutions to standard programming problems, this book introduces many useful, productivity-increasing, general-purpose, templatelike patterns---sometimes called cliches by experienced programmers---that you can fill in to achieve particular-purpose goals. Cliches are introduced, because learning to program involves more than learning to use programming-language primitives, just as learning to speak a human language involves more than learning to use vocabulary words.
To deepen your understanding of the art of good programming practice, this book emphasizes the value of such ideas as data abstraction and procedure abstraction.
In this book, single-idea segments, analogous to slides, are arranged in sections that are analogous to slide shows. The segments come in several varieties: basic segments explain essential ideas; sidetrip segments introduce interesting, but skippable, ideas; practice segments provide opportunities to experiment with new ideas; and highlights segments summarize important points.
Finally, the book develops a simple, yet realistic C program, which you see in many versions as your understanding of the language increases. In its ultimate version, the program reads data from a file containing recent stock-market information, computes the average price per share and number of shares traded, and predicts the next-day's price using a straight line fitted to previous prices. The statistical flavor of the example is meant to suggest the popularity of C as a language for implementing statistical-analysis programs.
Highlights