The C programming language

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Brian W Kernighan; Dennis M Ritchie
Edition: 2nd ed
Publisher: Prentice Hall
Year: 1988

Language: English
Pages: 238
City: Englewood Cliffs, N.J

Preface......Page 6
Preface to the first edition......Page 8
1.1 Getting Started......Page 9
1.2 Variables and Arithmetic Expressions......Page 11
1.3 The for statement......Page 16
1.4 Symbolic Constants......Page 17
1.5.1 File Copying......Page 18
1.5.2 Character Counting......Page 20
1.5.3 Line Counting......Page 21
1.5.4 Word Counting......Page 22
1.6 Arrays......Page 23
1.7 Functions......Page 25
1.8 Arguments - Call by Value......Page 28
1.9 Character Arrays......Page 29
1.10 External Variables and Scope......Page 31
2.2 Data Types and Sizes......Page 35
2.3 Constants......Page 36
2.4 Declarations......Page 39
2.6 Relational and Logical Operators......Page 40
2.7 Type Conversions......Page 41
2.8 Increment and Decrement Operators......Page 44
2.9 Bitwise Operators......Page 46
2.10 Assignment Operators and Expressions......Page 47
2.12 Precedence and Order of Evaluation......Page 49
3.2 If-Else......Page 52
3.3 Else-If......Page 53
3.4 Switch......Page 54
3.5 Loops - While and For......Page 56
3.6 Loops - Do-While......Page 59
3.8 Goto and labels......Page 60
4.1 Basics of Functions......Page 62
4.2 Functions Returning Non-integers......Page 65
4.3 External Variables......Page 67
4.4 Scope Rules......Page 72
4.5 Header Files......Page 74
4.7 Register Variables......Page 75
4.8 Block Structure......Page 76
4.9 Initialization......Page 77
4.10 Recursion......Page 78
4.11.1 File Inclusion......Page 79
4.11.2 Macro Substitution......Page 80
4.11.3 Conditional Inclusion......Page 82
5.1 Pointers and Addresses......Page 83
5.2 Pointers and Function Arguments......Page 84
5.3 Pointers and Arrays......Page 87
5.4 Address Arithmetic......Page 90
5.5 Character Pointers and Functions......Page 93
5.6 Pointer Arrays; Pointers to Pointers......Page 96
5.7 Multi-dimensional Arrays......Page 99
5.9 Pointers vs. Multi-dimensional Arrays......Page 101
5.10 Command-line Arguments......Page 102
5.11 Pointers to Functions......Page 106
5.12 Complicated Declarations......Page 108
6.1 Basics of Structures......Page 114
6.2 Structures and Functions......Page 116
6.3 Arrays of Structures......Page 118
6.4 Pointers to Structures......Page 122
6.5 Self-referential Structures......Page 124
6.6 Table Lookup......Page 127
6.7 Typedef......Page 130
6.8 Unions......Page 131
6.9 Bit-fields......Page 132
7.1 Standard Input and Output......Page 135
7.2 Formatted Output - printf......Page 137
7.3 Variable-length Argument Lists......Page 138
7.4 Formatted Input - Scanf......Page 140
7.5 File Access......Page 142
7.6 Error Handling - Stderr and Exit......Page 145
7.7 Line Input and Output......Page 146
7.8.1 String Operations......Page 147
7.8.5 Storage Management......Page 148
7.8.7 Random Number generation......Page 149
8.1 File Descriptors......Page 151
8.2 Low Level I/O - Read and Write......Page 152
8.3 Open, Creat, Close, Unlink......Page 153
8.4 Random Access - Lseek......Page 155
8.5 Example - An implementation of Fopen and Getc......Page 156
8.6 Example - Listing Directories......Page 159
8.7 Example - A Storage Allocator......Page 163
A.2.3 Identifiers......Page 168
A.2.5.1 Integer Constants......Page 169
A.2.5.3 Floating Constants......Page 170
A.4 Meaning of Identifiers......Page 171
A.4.2 Basic Types......Page 172
A.6 Conversions......Page 173
A.6.5 Arithmetic Conversions......Page 174
A.6.6 Pointers and Integers......Page 175
A.7 Expressions......Page 176
A.7.3 Postfix Expressions......Page 177
A.7.3.2 Function Calls......Page 178
A.7.3.4 Postfix Incrementation......Page 179
A.7.4.5 Unary Minus Operator......Page 180
A.7.6 Multiplicative Operators......Page 181
A.7.8 Shift Operators......Page 182
A.7.11 Bitwise AND Operator......Page 183
A.7.15 Logical OR Operator......Page 184
A.7.18 Comma Operator......Page 185
A.8 Declarations......Page 186
A.8.1 Storage Class Specifiers......Page 187
A.8.2 Type Specifiers......Page 188
A.8.3 Structure and Union Declarations......Page 189
A.8.5 Declarators......Page 192
A.8.6.1 Pointer Declarators......Page 193
A.8.6.3 Function Declarators......Page 194
A.8.7 Initialization......Page 196
A.8.8 Type names......Page 198
A.9 Statements......Page 199
A.9.3 Compound Statement......Page 200
A.9.5 Iteration Statements......Page 201
A.9.6 Jump statements......Page 202
A.10.1 Function Definitions......Page 203
A.10.2 External Declarations......Page 204
A.11 Scope and Linkage......Page 205
A.12 Preprocessing......Page 206
A.12.3 Macro Definition and Expansion......Page 207
A.12.4 File Inclusion......Page 209
A.12.5 Conditional Compilation......Page 210
A.12.7 Error Generation......Page 211
A.13 Grammar......Page 212
B.1 Input and Output: ......Page 220
B.1.1 File Operations......Page 221
B.1.2 Formatted Output......Page 222
B.1.3 Formatted Input......Page 223
B.1.5 Direct Input and Output Functions......Page 225
B.2 Character Class Tests: ......Page 226
B.3 String Functions: ......Page 227
B.4 Mathematical Functions: ......Page 228
B.5 Utility Functions: ......Page 229
B.7 Variable Argument Lists: ......Page 231
B.9 Signals: ......Page 232
B.10 Date and Time Functions: ......Page 233
B.11 Implementation-defined Limits: and ......Page 235
Appendix C - Summary of Changes......Page 236