Synopses & Reviews
Learning a language--any language--involves a process wherein you learn to rely less and less on instruction and more increasingly on the aspects of the language you've mastered. Whether you're learning French, Java, or C, at some point you'll set aside the tutorial and attempt to converse on your own. It's not necessary to know every subtle facet of French in order to speak it well, especially if there's a good dictionary available. Likewise, C programmers don't need to memorize every detail of C in order to write good programs. What they need instead is a reliable, comprehensive reference that they can keep nearby. C in a Nutshell is that reference.
This long-awaited book is a complete reference to the C programming language and C runtime library. Its purpose is to serve as a convenient, reliable companion in your day-to-day work as a C programmer. C in a Nutshell covers virtually everything you need to program in C, describing all the elements of the language and illustrating their use with numerous examples.
The book is divided into three distinct parts. The first part is a fast-paced description, reminiscent of the classic Kernighan & Ritchie text on which many C programmers cut their teeth. It focuses specifically on the C language and preprocessor directives, including extensions introduced to the ANSI standard in 1999. These topics and others are covered:
- Numeric constants
- Implicit and explicit type conversions
- Expressions and operators
- Fixed-length and variable-length arrays
- Dynamic memory management
- Input and output
The second part of the book is a comprehensive reference to the C runtime library; it includes an overview of the contents of the standard headers and a description of each standard library function. Part III provides the necessary knowledge of the C programmer's basic tools: the compiler, the make utility, and the debugger. The tools described here are those in the GNU software collection.
C in a Nutshell is the perfect companion to K&R, and destined to be the most reached-for reference on your desk.
In this one, handy book, programmers get virtually everything they need to program in C, long established as an ANSI standard. The C programming language has been around since 1971 and is still the language of choice for many applications.
About the Author
Peter is a seminar leader and key course developer, teaching courses to thousands of software developers for Unix and Windows systems. As the chief developer and cofounder of the IT company Authensis AG in Germany, he has gained extensive experience in software development for computer telephony. Peter is also the author of several other books on software development in C/C++, most of them as co-author with Ulla Kirch-Prinz, including O'Reilly's "C Pocket Reference".
Tony Crawford is a technical-writer and freelance translator with a strong C background based just outside Berlin, Germany. In addition to regular software localization projects, he has translated books on network administration and ATM. A US native, Tony completed undergraduate work at Occidental College, Los Angeles; Universit de Perpignan, France; and Technische Universit t, Berlin. Tony translates from German into English.
Table of Contents
Preface; How This Book Is Organized; Further Reading; Conventions Used in This Book; Using Code Examples; Safari® Enabled; Your Questions and Comments; Acknowledgments; Part I: Language; Chapter 1: Language Basics; 1.1 Characteristics of C; 1.2 The Structure of C Programs; 1.3 Source Files; 1.4 Comments; 1.5 Character Sets; 1.6 Identifiers; 1.7 How the C Compiler Works; Chapter 2: Types; 2.1 Typology; 2.2 Integer Types; 2.3 Floating-Point Types; 2.4 Complex Floating-Point Types (C99); 2.5 Enumerated Types; 2.6 The Type void; Chapter 3: Literals; 3.1 Integer Constants; 3.2 Floating-Point Constants; 3.3 Character Constants; 3.4 String Literals; Chapter 4: Type Conversions; 4.1 Conversion of Arithmetic Types; 4.2 Conversion of Nonarithmetic Types; Chapter 5: Expressions and Operators; 5.1 How Expressions Are Evaluated; 5.2 Operators in Detail; 5.3 Constant Expressions; Chapter 6: Statements; 6.1 Expression Statements; 6.2 Block Statements; 6.3 Loops; 6.4 Selection Statements; 6.5 Unconditional Jumps; Chapter 7: Functions; 7.1 Function Definitions; 7.2 Function Declarations; 7.3 How Functions Are Executed; 7.4 Pointers as Arguments and Return Values; 7.5 Inline Functions; 7.6 Recursive Functions; 7.7 Variable Numbers of Arguments; Chapter 8: Arrays; 8.1 Defining Arrays; 8.2 Accessing Array Elements; 8.3 Initializing Arrays; 8.4 Strings; 8.5 Multidimensional Arrays; 8.6 Arrays as Arguments of Functions; Chapter 9: Pointers; 9.1 Declaring Pointers; 9.2 Operations with Pointers; 9.3 Pointers and Type Qualifiers; 9.4 Pointers to Arrays and Arrays of Pointers; 9.5 Pointers to Functions; Chapter 10: Structures and Unions and Bit-Fields; 10.1 Structures; 10.2 Unions; 10.3 Bit-Fields; Chapter 11: Declarations; 11.1 General Syntax; 11.2 Type Names; 11.3 typedef Declarations; 11.4 Linkage of Identifiers; 11.5 Storage Duration of Objects; 11.6 Initialization; Chapter 12: Dynamic Memory Management; 12.1 Allocating Memory Dynamically; 12.2 Characteristics of Allocated Memory; 12.3 Resizing and Releasing Memory; 12.4 An All-Purpose Binary Tree; 12.5 Characteristics; 12.6 Implementation; Chapter 13: Input and Output; 13.1 Streams; 13.2 Files; 13.3 Opening and Closing Files; 13.4 Reading and Writing; 13.5 Random File Access; Chapter 14: Preprocessing Directives; 14.1 Inserting the Contents of Header Files; 14.2 Defining and Using Macros; 14.3 Conditional Compiling; 14.4 Defining Line Numbers; 14.5 Generating Error Messages; 14.6 The #pragma Directive; 14.7 The _Pragma Operator; 14.8 Predefined Macros; Part II: Standard Library; Chapter 15: The Standard Headers; 15.1 Using the Standard Headers; 15.2 Contents of the Standard Headers; Chapter 16: Functions at a Glance; 16.1 Input and Output; 16.2 Mathematical Functions; 16.3 Character Classification and Conversion; 16.4 String Processing; 16.5 Multibyte Characters; 16.6 Converting Between Numbers and Strings; 16.7 Searching and Sorting; 16.8 Memory Block Handling; 16.9 Dynamic Memory Management; 16.10 Date and Time; 16.11 Process Control; 16.12 Internationalization; 16.13 Nonlocal Jumps; 16.14 Debugging; 16.15 Error Messages; Chapter 17: Standard Library Functions; Part III: Basic Tools; Chapter 18: Compiling with GCC; 18.1 The GNU Compiler Collection; 18.2 Obtaining and Installing GCC; 18.3 Compiling C Programs with GCC; 18.4 C Dialects; 18.5 Compiler Warnings; 18.6 Optimization; 18.7 Debugging; 18.8 Profiling; 18.9 Option and Environment Variable Summary; Chapter 19: Using make to Build C Programs; 19.1 Targets, Prerequisites, and Commands; 19.2 The Makefile; 19.3 Rules; 19.4 Comments; 19.5 Variables; 19.6 Phony Targets; 19.7 Other Target Attributes; 19.8 Macros; 19.9 Functions; 19.10 Directives; 19.11 Running make; Chapter 20: Debugging C Programs with GDB; 20.1 Installing GDB; 20.2 A Sample Debugging Session; 20.3 Starting GDB; 20.4 Using GDB Commands; Colophon;