标题：标准C程序设计（第3版影印版）
内容简介
本书是印度各大学使用最广的C语言程序设计教材之一。
本书旨在教授读者如何使用C语言进行程序设计。全书贯彻了“用示例
学习”的概念。在深入介绍了C语言的每个特性之后，给出了一个完整的示
例程序，用于演示说明其应用。每章末尾的“案例学习”不仅介绍了把C语
言的特性集成在一起的常用方法，而且还显示了它在实际生活中的应用。最
后一章介绍了开发高效、无错误的C程序的一些指导原则。
本书第3版融入了过去10年中采用本书的学生和老师的很多反馈意见。
总之，本书的语言简洁易懂，示例非常丰富且具有很强的实际指导意义
，是一本很好的C语言程序设计的教材。
本书目录
1. Overview of C 1
1.1 History of C 1
1.2 Importance of C 2
1.3 Sample Program 1: Printing a Message 3
1.4 Sample Program 2: Adding Two Numbers 6
1.5 Sample Program 3: Interest Calculation 7
1.6 Sample Program 4: Use of Subroutines 9
1.7 Sample Program 5: Use of Math Functions 10
1.8 Basic Structure of C Programs 12
1.9 Programming Style 13
1.10 Executing a ‘C’ Program 14
1.11 Unix System 14
1.12 MS-DOS System 17
Review Questions 18
Programming Exercises 20
2. Constants, Variables, and Data Types 22
2.1 Introduction 22
2.2 Character Set 22
2.3 C Tokens 24
2.4 Keywords and Identifiers 24
2.5 Constants 25
2.6 Variables 29
2.7 Data Types 30
2.8 Declaration of Variables 33
2.9 Declaration of Storage Class 36
2.10 Assigning Values to Variables 38
2.11 Defining Symbolic Constants 43
2.12 Declaring a Variable as Constant 44
2.13 Declaring a Variable as Volatile 45
2.14 Overflow and Underflow of Data 45
Case Studies 46
Review Questions 48
Programming Exercises 50
3. Operators and Expressions 51
3.1 Introduction 51
3.2 Arithmetic Operators 51
3.3 Relational Operators 54
3.4 Logical Operators 55
3.5 Assignment Operators 56
3.6 Increment and Decrement Operators 58
3.7 Conditional Operator 59
3.8 Bitwise Operators 60
3.9 Special Operators 60
3.10 Arithmetic Expressions 62
3.11 Evaluation of Expressions 62
3.12 Precedence of Arithmetic Operators 64
3.13 Some Computational Problems 66
3.14 Type Conversions in Expressions 67
3.15 Operator Precedence and Associativity 70
3.16 Mathematical Functions 72
Case Studies 73
Review Questions 76
Programming Exercises 78
4. Managing Input and Output Operations 80
4.1 Introduction 80
4.2 Reading a Character 81
4.3 Writing a Character 84
4.4 Formatted Input 85
4.5 Formatted Output 94
Case Studies 103
Review Questions 106
Programming Exercises 108
5. Decision Making and Branching 110
5.1 Introduction 110
5.2 Decision Making with if Statement 110
5.3 Simple if Statement 111
5.4 The if.....else Statement 115
5.5 Nesting of if....else Statements 118
5.6 The Else if Ladder 122
5.7 The Switch Statement 125
5.8 The ? : Operator 129
5.9 The Goto Statement 132
Case Studies 135
Review Questions 139
Programming Exercises 142
6. Decision Making and Looping 145
6.1 Introduction 145
6.2 The While Statement 147
6.3 The do Statement 150
6.4 The for Statement 152
6.5 Jumps in Loops 159
Case Studies 168
Review Questions 174
Programming Exercises 177
7. Arrays 180
7.1 Introduction 180
7.2 One-dimensional Arrays 182
7.3 Declaration of One-dimensional Arrays 183
7.4 Initialization of One-dimensional Arrays 185
7.5 Two-dimensional Arrays 189
7.6 Initializing Two-dimensional Arrays 193
7.7 Multi-dimensional Arrays 197
7.8 Dynamic Arrays 198
7.9 More About Arrays 199
Case Studies 200
Review Questions 212
Programming Exercises 214
8. Character Arrays and Strings 217
8.1 Introduction 217
8.2 Declaring and Initializing String Variables 218
8.3 Reading Strings From Terminal 219
8.4 Writing Strings to Screen 224
8.5 Arithmetic Operations on Characters 228
8.6 Putting Strings Together 230
8.7 Comparison of Two Strings 231
8.8 String-handling Functions 232
8.9 Table of Strings 237
8.10 Other Features of Strings 239
Case Studies 240
Review Questions 243
Programming Exercises 245
9. User-defined Functions 247
9.1 Introduction 247
9.2 Need for User-defined Functions 247
9.3 A Multi-function Program 248
9.4 Elements of User-defined Functions 251
9.5 Definition of Functions 252
9.6 Return Values and their Types 254
9.7 Function Calls 255
9.8 Function Declaration 257
9.9 Category of Functions 259
9.10 No Arguments and No Return Values 259
9.11 Arguments but No Return Values 261
9.12 Arguments with Return Values 265
9.13 No Arguments but Returns a Value 269
9.14 Functions that Return Multiple Values 269
9.15 Nesting of Functions 271
9.16 Recursion 272
9.17 Passing Arrays to Functions 273
9.18 Passing Strings to Functions 278
9.19 The Scope, Visibility and Lifetime of Variables 279
9.20 Multifile Programs 289
Case Study 292
Review Questions 295
Programming Exercises 299
10. Structures and Unions 301
10.1 Introduction 301
10.2 Defining a Structure 301
10.3 Declaring Structure Variables 303
10.4 Accessing Structure Members 304
10.5 Structure Initialization 306
10.6 Copying and Comparing Structure Variables 307
10.7 Operations on Individual Members 309
10.8 Arrays of Structures 310
10.9 Arrays within Structures 313
10.10 Structures within Structures 314
10.11 Structures and Functions 316
10.12 Unions 319
10.13 Size of Structures 320
10.14 Bit Fields 321
Case Study 324
Review Questions 328
Programming Exercises 331
11. Pointers 333
11.1 Introduction 333
11.2 Understanding Pointers 334
11.3 Accessing the Address of a Variable 336
11.4 Declaring Pointer Variables 337
11.5 Initialization of Pointer Variables 338
11.6 Accessing a Variable through its Pointer 340
11.7 Chain of Pointers 342
11.8 Pointer Expressions 343
11.9 Pointer Increments and Scale Factor 344
11.10 Pointers and Arrays 345
11.11 Pointers and Character Strings 349
11.12 Array of Pointers 351
11.13 Pointers as Function Arguments 352
11.14 Functions Returning Pointers 355
11.15 Pointers to Functions 355
11.16 Pointers and Structures 358
Case Studies 362
Review Questions 367
Programming Exercises 368
12. File Management in C 370
12.1 Introduction 370
12.2 Defining and Opening a File 371
12.3 Closing a File 372
12.4 Input/Output Operations on Files 373
12.5 Error Handling During I/O Operations 379
12.6 Random Access to Files 381
12.7 Command Line Arguments 386
Review Questions 389
Programming Exercises 390
13. Dynamic Memory Allocation and Linked Lists 391
13.1 Introduction 391
13.2 Dynamic Memory Allocation 391
13.3 Allocating a Block of Memory: Malloc 392
13.4 Allocating Multiple Blocks of Memory: Calloc 394
13.5 Releasing the Used Space: Free 395
13.6 Altering the Size of a Block: Realloc 396
13.7 Concepts of Linked Lists 397
13.8 Advantages of Linked Lists 400
13.9 Types of Linked Lists 401
13.10 Pointers Revisited 402
13.11 Creating a Linked List 404
13.12 Inserting an Item 407
13.13 Deleting an Item 410
13.14 Application of Linked Lists 412
Case Studies 413
Review Questions 420
Programming Exercises 421
14. The Preprocessor 423
14.1 Introduction 423
14.2 Macro Substitution 424
14.3 File Inclusion 428
14.4 Compiler Control Directives 429
14.5 ANSI Additions 432
Review Questions 435
Programming Exercises 436
15. Developing a C Program: Some Guidelines 437
15.1 Introduction 437
15.2 Program Design 437
15.3 Program Coding 439
15.4 Common Programming Errors 441
15.5 Program Testing and Debugging 448
15.6 Program Efficiency 451
Review Questions 451
Appendix I: Bit-level Programming 453
Appendix II: ASCII Values of Characters 459
Appendix III: ANSI C Library Functions 460
Appendix IV: A Phone Book 464
Bibliography 485
Index 486