Preface......Page 10
Preface to the First Edition......Page 12
Introduction......Page 14
1.1 Getting Started......Page 18
1.2 Variables and Arithmetic Expressions......Page 21
1.3 The For Statement......Page 26
1.4 Symbolic Constants......Page 27
1.5 Character Input and Output......Page 28
1.6 Arrays......Page 35
1.7 Functions......Page 37
1.8 Arguments - Call by Value......Page 40
1.9 Character Arrays......Page 41
1.10 External Variables and Scope......Page 44
2.1 Variable Names......Page 48
2.2 Data Types and Sizes......Page 49
2.3 Constants......Page 50
2.4 Declarations......Page 53
2.6 Relational and Logical Operators......Page 54
2.7 Type Conversions......Page 55
2.8 Increment and Decrement Operators......Page 59
2.9 Bitwise Operators......Page 61
2.10 Assignment Operators and Expressions......Page 63
2.11 Conditional Expressions......Page 64
2.12 Precedence and Order of Evaluation......Page 65
3.2 If-Else......Page 68
3.3 Else-If......Page 70
3.4 Switch......Page 71
3.5 Loops - While and For......Page 73
3.6 Loops - Do-while......Page 76
3.7 Break and Continue......Page 77
3.8 Goto and Labels......Page 78
4.1 Basics of Functions......Page 80
4.2 Functions Returning Non-integers......Page 84
4.3 External Variables......Page 86
4.4 Scope Rules......Page 93
4.5 Header Files......Page 94
4.7 Register Variables......Page 96
4.8 Block Structure......Page 97
4.9 Initialization......Page 98
4.10 Recursion......Page 99
4.11 The C Preprocessor......Page 101
5.1 Pointers and Addresses......Page 106
5.2 Pointers and Function Arguments......Page 108
5.3 Pointers and Arrays......Page 110
5.4 Address Arithmetic......Page 113
5.5 Character Pointers and Functions......Page 117
5.6 Pointer Arrays; Pointers to Pointers......Page 120
5.7 Multi-dimensional Arrays......Page 123
5.9 Pointers vs. Multi-dimensional Arrays......Page 126
5.10 Command-line Arguments......Page 127
5.11 Pointers to Functions......Page 131
5.12 Complicated Declarations......Page 135
6.1 Basics of Structures......Page 140
6.2 Structures and Functions......Page 142
6.3 Arrays of Structures......Page 145
6.4 Pointers to Structures......Page 149
6.5 Self-referential Structures......Page 152
6.6 Table Lookup......Page 156
6.7 Typedef......Page 159
6.8 Unions......Page 160
6.9 Bit-fields......Page 162
7.1 Standard Input and Output......Page 164
7.2 Formatted Output - Printf......Page 166
7.3 Variable-length Argument Lists......Page 168
7.4 Formatted Input - Scanf......Page 170
7.5 File Access......Page 173
7.6 Error Handling - Stderr and Exit......Page 176
7.7 Line Input and Output......Page 177
7.8 Miscellaneous Functions......Page 179
8.1 File Descriptors......Page 182
8.2 Low Level I/O-Read and Write......Page 183
8.3 Open, Creat, Close, Unlink......Page 185
8.4 Random Access - Lseek......Page 187
8.5 Example - An Implementation of Fopen and Getc......Page 188
8.6 Example - Listing Directories......Page 192
8.7 Example - A Storage Allocator......Page 198
A2 Lexical Conventions......Page 204
A3 Syntax Notation......Page 207
A6 Conversions......Page 210
A7 Expressions......Page 213
A8 Declarations......Page 223
A9 Statements......Page 235
A10 External Declarations......Page 238
All Scope and Linkage......Page 240
A12 Preprocessing......Page 241
A13 Grammar......Page 247
Bl Input and Output:
......Page 254
B2 Character Class Tests: ......Page 261
B3 String Functions: ......Page 262
B4 Mathematical Functions: ......Page 263
B5 Utility Functions: ......Page 264
B6 Diagnostics: ......Page 266
B8 Non-local Jumps: ......Page 267
B10 Date and Time Functions: ......Page 268
B11 Implementation-defined Limits: and ......Page 270
Appendix C. Summary of Changes......Page 272
Index......Page 276