Cover
Chapter 1 -- A Quick Start
1.1 Introduction
1.1.1 Spacing and Comments
1.1.2 Preprocessor Directives
1.1.3 The Main Function
1.1.4 The read_column_numbers Function
1.2 Other Capabilities
1.3 Compiling
1.4 Summary
1.5 Summary of Cautions
1.6 Summary of Programming Tips
1.7 Questions
1.8 Programming Exercises
Chapter 2 -- Basic Concepts
2.1 Environments
2.1.1 Translation
Filename Conventions
Compiling and Linking
2.1.2 Execution
2.2 Lexical Rules
2.2.1 Characters
2.2.2 Comments
2.2.3 Free Form Source Code
2.2.4 Identifiers
2.2.5 Form of a Program
2.3 Program Style
2.4 Summary
2.5 Summary of Cautions
2.6 Summary of Programming Tips
2.7 Questions
2.8 Programming Exercises
Chapter 3 -- Data
3.1 Basic Data Types
3.1.1 The Integer Family
Integer Literals
Enumerated Type
3.1.2 Floating-Pint Types
3.1.3 Pointers
Pointer Constants
String Literals
3.2 Basic Declarations
3.2.1 Initialization
3.2.2 Declaring Simple Arrays
3.2.3 Declaring Pointers
3.2.4 Implicit Declarations
3.3 Typedef
3.4 Constants
3.5 Scope
3.5.1 Block Scope
3.5.2 File Scope
3.5.3 Prototype Scope
3.5.4 Function Scope
3.6 Linkage
3.7 Storage Class
3.7.1 Initialization
3.8 The Static Keyword
3.9 Scope, Linkage, and Storage Class Example
3.10 Summary
3.11 Summary of Cautions
3.12 Summary of Programming Tips
3.13 Questions
Chapter 4 -- Statements
4.1 Empty Statement
4.2 Expression Statement
4.3 Statement Blocks
4.4 If Statement
4.5 While Statement
4.5.1 Break and Continue Statements
4.5.2 Execution of the While
4.6 For Statement
4.6.1 Execution of a For
4.7 Do statement
4.8 Switch Statement
4.8.1 break in a switch
4.8.2 Defaults
4.8.3 Execution of the Switch
4.9 Goto Statement
4.10 Summary
4.11 Summary of Cautions
4.12 Summary of Programming Tips
4.13 Questions
4.14 Programming Exercises
Chapter 5 -- Operators and Expressions
5.1 Operators
5.1.1 Arithmetic
5.1.2 Shifting
5.1.3 Bitwise
Bit Manipulation
5.1.4 Assignment
Compound Assignment
5.1.5 Unary
5.1.6 Relational
5.1.7 Logical
5.1.8 Conditional
5.1.9 Comma
5.1.10 Subscript, Function Call, and Structure Member
5.2 Boolean Values
5.3 L-values and R-values
5.4 Expression Evaluation
5.4.1 Implicit Type Conversions
5.4.2 Arithmetic Conversions
5.4.3 Properties of Operators
5.4.4 Precedence and Order of Evaluation
5.5 Summary
5.6 Summary of Cautions
5.7 Summary of Programming Tips
5.8 Summary
5.9 Programming Exercises
Chapter 6 -- Pointers
6.1 Memory and Addresses
6.1.1 Address Versus Contents
6.2 Values and Their Types
6.3 Contents of a Pointer Variable
6.4 Indirection Operator
6.5 Uninitialized and Illegal Pointer
6.6 The Null Pointer
6.7 Pointers, Indirection, and L-values
6.8 Pointers, Indirection, and Variables
6.9 Pointer Constants
6.10 Pointers to Pointers
6.11 Pointer Expressions
6.12 Examples
6.13 Pointer Arithmetic
6.13.1 Arithmetic Operations
6.13.2 Relational Operations
6.14 Summary
6.15 Summary of Cautions
6.16 Summary of Programming Tips
6.17 Questions
6.18 Programming Exercises
Chapter 7 -- Functions
7.1 Function Definition
7.1.1 Return Statement
7.2 Function Declaration
7.2.1 Prototypes
7.2.2 Default Function Assumptions
7.3 Function Arguments
7.4 ADTs and Black Boxes
7.5 Recursion
7.5.1 Tracing a Recursive Function
7.5.2 Recursion versus Iteration
7.6 Variable Argument Lists
7.6.1 The stdarg Macros
7.6.2 Limitations of Variable Arguments
7.7 Summary
7.8 Summary of Cautions
7.9 Summary of Programming Tips
7.10 Questions
7.11 Programming Exercises
Chapter 8 -- Arrays
8.1 One-Dimensional Arrays
8.1.1 Array Names
8.1.2 Subscripts
8.1.3 Pointers versus Subscripts
8.1.4 Pointer Efficiency
Switching to Pointers
Bringing Back the Counter
Register Pointer Variables
Eliminating the Counter
Conclusions
8.1.5 Arrays and Pointers
8.1.6 Array Names as Function Arguments
8.1.7 Declaring Array Parameters
8.1.8 Initialization
Static and Automatic Initialization
8.1.9 Incomplete Initialization
8.1.10 Automatic Array Sizing
8.1.11 Character Array Initialization
8.2 Multidimensional Arrays
8.2.1 Storage Order
8.2.2 Array Names
8.2.3 Subscripts
8.2.4 Pointers to Arrays
8.2.5 Multidimensional Arrays as Function Arguments
8.2.6 Initialization
8.2.7 Automatic Array Sizing
8.3 Arrays of Pointers
8.4 Summary
8.5 Summary of Cautions
8.6 Summary of Programming Tips
8.7 Questions
8.8 Programming Exercises
Chapter 9 -- Strings, Characters, and Bytes
9.1 String Basics
9.2 String Length
9.3 Unrestricted String Functions
9.3.1 Copying Strings
9.3.2 Concatenating Strings
9.3.3 Function Return Value
9.3.4 String Comparisons
9.4 Length-Restricted String Functions
9.5 Basic String Searching
9.5.1 Finding a Character
9.5.2 Finding Any of Several Characters
9.5.3 Finding a Substring
9.6 Advanced String Searching
9.6.1 Finding String Prefixes
9.6.2 Finding Tokens
9.7 Error Messages
9.8 Character Operations
9.8.1 Character Classification
9.8.2 Character Transformation
9.9 Memory Operations
9.10 Summary
9.11 Summary of Cautions
9.12 Summary of Programming Tips
9.13 Questions
9.14 Programming Exercises
Chapter 10 -- Structures and Unions
10.1 Structure Basics
10.1.1 Structure Declarations
10.1.2 Structure Members
10.1.3 Direct Member Access
10.1.4 Indirect Member Access
10.1.5 Self-Referential Structures
10.1.6 Incomplete Declarations
10.1.7 Initializing Structures
10.2 Structures, Pointers, and Members
10.2.1 Accessing the Pointer
10.2.2 Accessing the Structure
10.2.3 Accessing Structure Members
10.2.4 Accessing a Nested Structure
10.2.5 Accessing a Pointer Member
10.3 Structure Storage Allocation
10.4 Structures as Function Arguments
10.5 Bit Fields
10.6 Unions
10.6.1 Variant Records
10.6.2 Initializing Unions
10.7 Summary
10.8 Summary of Cautions
10.9 Summary of Programming Tips
10.10 Questions
10.11 Programming Exercises
Chapter 11 -- Dynamic Memory Allocation
11.1 Why Use Dynamic Allocation
11.2 Malloc and Free
11.3 Calloc and Realloc
11.4 Using Dynamically Allocated Memory
11.5 Common Dynamic Memory Errors
11.5.1 Memory Leaks
11.6 Memory Allocation Examples
11.7 Summary
11.8 Summary of Cautions
11.9 Summary of Programming Tips
11.10 Questions
11.11 Programming Exercises
Chapter 12 -- Using Structures and Pointers
12.1 Linked Lists
12.2 Singly Linked Lists
12.2.1 Inserting into a Singly Linked List
Debugging the Insert Function
Optimizing the Insert Function
12.2.2 Other List Operations
12.3 Doubly Linked Lists
12.3.1 Inserting into a Doubly Linked List
Simplifying the Insert Function
12.3.2 Other List Operations
12.4 Summary
12.5 Summary of Cautions
12.6 Summary of Programming Tips
12.7 Questions
12.8 Programming Exercises
Chapter 13 -- Advanced Pointers Topics
13.1 More Pointers to Pointers
13.2 Advanced Declarations
13.3 Pointers to Functions
13.3.1 Callback Functions
13.3.2 Jump Tables
13.4 Command Line Arguments
13.4.1 Passing Command Line Arguments
13.4.2 Processing Command Line Arguments
13.5 String Literals
13.6 Summary
13.7 Summary of Cautions
13.8 Summary of Programming Tips
13.9 Questions
13.10 Programming Exercises
Chapter 14 -- The Preprocessor
14.1 Predefined Symbols
14.2 #define
14.2.1 Macros
14.2.2 #define Substitution
14.2.3 Macros versus Functions
14.2.4 Macro Arguments with Side Effects
14.2.5 Naming Conventions
14.2.6 #undef
14.2.7 Command Line Definitions
14.3 Conditional Compilation
14.3.1 If Defined
14.3.2 Nested Directives
14.4 File Inclusion
14.4.1 Library Includes
14.4.2 Local Includes
14.4.3 Nested File Inclusion
14.5 Other Directives
14.6 Summary
14.7 Summary of Cautions
14.8 Summary of Programming Tips
14.9 Questions
14.10 Programming Exercises
Chapter 15 -- Input/Output Functions
15.1 Error Reporting
15.2 Terminating Execution
15.3 The Standard I/O Library
15.4 ANSI I/O Concepts
15.4.1 Streams
Text Streams
Binary Streams
15.4.2 FILEs
15.4.3 Standard I/O Constants
15.5 Overview of Stream I/O
15.6 Opening Streams
15.7 Closing Streams
15.8 Character I/O
15.8.1 Character I/O Macros
15.8.2 Undoing Character I/O
15.9 Unformatted Line I/O
15.10 Formatted Line I/O
15.10.1 The scanf Family
15.10.2 scanf Format Codes
15.10.3 The printf Family
15.10.4 printf Format Codes
15.11 Binary I/O
15.12 Flushing and Seeking Functions
15.13 Changing the Buffering
15.14 Stream Error Functions
15.15 Temporary Files
15.16 File Manipulation Functions
15.17 Summary
15.18 Summary of Cautions
15.19 Summary of Programming Tips
15.20 Questions
15.21 Programming Exercises
Chapter 16 -- Standard Library
16.1 Integer Functions
16.1.1 Arithmetic