The C Book is designed for programmers who already have some experience of using a modern high-level procedural programming language. The book concentrates on the things that are special to C. In particular, it is the way that C is used which is focused on.
This is the online version of The C Book, second edition by originally published by Addison Wesley in 1991. This version is made freely available.
While this book is no longer in print, its content is still very relevant today. The C language is still popular, particularly for open source software and embedded programming. We hope this book will be useful, or at least interesting, to people who use C.
An alternative version in pdf was later submitted in July 2010 by Ward van Wanrooij . We make no representations for the accuracy or otherwise of either pdf version.
Author: Mike Banahan, Declan Brady and Mark Doran
- An Introduction to C
- Variables and Arithmetic – introduces some of the fundamentals of C, including keywords and identifiers, declaration of variables, real types, integral types, expressions and arithmetic, and constants
- Control of Flow and Logical Expressions – looks at the various ways that the control of flow statements can be used in a C program, including some statements that have not been introduced so far. Control of flow, more logical expressions, and strange operators
- Functions – the type of functions, recursion and argument passing, and linkage
- Arrays and Pointers – arrays, pointers, character handling, sizeof and storage allocation, pointers to functions, expressions involving pointers, arrays, the & operator and function declarations
- Structured Data Types – structures, unions, bitfields, enums, qualifiers and derived types, and initialization
- The Preprocessor – how the preprocessor works, and directives
- Specialized Areas of C – declarations, definitions and accessibility, typedef, const and volatile, and sequence points
- Libraries – diagnostics, character handling, localization, limits, mathematical functions, non-local jumps, signal handling, variable numbers of arguments, input and output, formatted I/O, character I/O, unformatted I/O, random access functions, general utilities, string handling, and date and time
- Complete Programs in C – putting it all together, arguments to main, interpreting program arguments, a pattern matching program, and a more ambitious example
Permission is hereby granted for anyone to do anything that they want with this material—you may freely reprint it, redistribute it, amend it or do whatever you like with it provided that you include an acknowledgement of the original authorship and copyright in the form of a link to this page. In doing so you must accept that you do so strictly on your own liability and that you accept any consequences with no liability whatsoever remaining with the original authors. If you find the material useful and happen to encounter one of the authors, it is unlikely that they will refuse offers to buy them a drink.