图书简介
This second edition of Programming in C is designed to serve as a textbook for the undergraduate students of engineering, computer applications, and computer science for a basic course on C programming. It provides a comprehensive coverage of the fundamental concepts of C programming.
1 Introduction to Programming; 1.1 Introduction to Computer Software 1; 1.2 Classification of Computer Software 2; 1.2.1 System Software 2; 1.2.2 Application Software 5; 1.3 Programming Languages 5; 1.4 Generation of Programming Languages 6; 1.4.1 First Generation: Machine Language 6; 1.4.2 Second Generation: Assembly Language 7; 1.4.3 Third Generation Programming Languages 7; 1.4.4 Fourth Generation: Very High-level Languages 8; 1.4.5 Fifth Generation Programming Languages 8; 2 Introduction to C; 2.1 Introduction 12; 2.1.1 Background 12; 2.1.2 Characteristics of C 13; 2.1.3 Uses of C 14; 2.2 Structure of a C Program 14; 2.3 Writing the First C Program 15; 2.4 Files Used in a C Program 16; 2.4.1 Source Code Files 16; 2.4.2 Header files 16; 2.4.3 Object Files 17; 2.4.4 Binary Executable Files 17; 2.5 Compiling and Executing C Programs 17; 2.6 Using Comments 18; 2.7 C tokens 19; 2.8 Character Set in C 19; 2.9 Keywords 19; 2.10 Identifiers 20; 2.10.1 Rules for Forming Identifier Names 20; 2.11 Basic Data Types in C 20; 2.11.1 How are Float and Double Stored? 21; 2.12 Variables 22; 2.12.1 Numeric Variables 22; 2.12.2 Character Variables 22; 2.12.3 Declaring Variables 22; 2.12.4 Initializing Variables 22; 2.13 Constants 23; 2.13.1 Integer Constants 23; 2.13.2 Floating Point Constants 23; 2.13.3 Character Constants 24; 2.13.4 String Constants 24; 2.13.5 Declaring Constants 24; 2.14 Input/Output Statements in C 24; 2.14.1 Streams 24; 2.14.2 Formatting input/output 25; 2.14.3 printf() 25; 2.14.4 scanf() 28; 2.14.5 Examples of printf/scanf 30; 2.14.6 Detecting Errors During Data Input; 2.15 Operators in C 32; 2.15.1 Arithmetic Operators 32; 2.15.2 Relational Operators 34; 2.15.3 Equality Operators 35; 2.15.4 Logical Operators 35; 2.15.5 Unary Operators 36; 2.15.6 Conditional Operator 37; 2.15.7 Bitwise Operators 38; 2.15.8 Assignment Operators 39; 2.15.9 Comma Operator 40; 2.15.10 Sizeof Operator 40; 2.15.11 Operator Precedence Chart 40; 2.16 Type Conversion and Typecasting 46; 2.16.1 Type Conversion 46; 2.16.2 Typecasting 47; Annexure 1 56; 3 Decision Control and Looping Statements; 3.1 Introduction to Decision Control Statements 57; 3.2 Conditional Branching Statements 57; 3.2.1 if Statement 57; 3.2.2 IfElse Statement 59; 3.2.3 IfElseIf Statement 61; 3.2.4 Switch Case 65; 3.3 Iterative Statements 69; 3.3.1 While loop 69; 3.3.2 Do-while Loop 72; 3.3.3 For Loop 75; 3.4 Nested Loops 78; 3.5 The Break and Continue Statements 87; 3.5.1 break Statement 87; 3.5.2 continue Statement 88; 3.6 goto Statement 89; Case Study 1: Chapters 2 and 3 101; 4 Functions; 4.1 Introduction 105; 4.1.1 Why are functions needed? 105; 4.2 Using Functions 106; 4.3 Function Declaration/Function Prototype 107; 4.4 Function Definition 108; 4.5 Function Call 108; 4.5.1 Points to Remember While Calling Functions 109; 4.6 Return Statement 110; 4.6.1 Using Variable Number of Arguments 110; 4.7 Passing Parameters to Functions 111; 4.7.1 Call by Value 111; 4.7.2 Call by Reference 112; 4.8 Scope of Variables 115; 4.8.1 Block Scope 115; 4.8.2 Function Scope 116; 4.8.3 Program Scope 116; 4.8.4 File Scope 117; 4.9 Storage Classes 117; 4.9.1 auto Storage Class 117; 4.9.2 register Storage Class 118; 4.9.3 extern Storage Class 119; 4.9.4 static Storage Class 119; 4.9.5 Comparison of Storage Classes 120; 4.10 Recursive Functions 120; 4.10.1 Greatest Common Divisor 122; 4.10.2 Finding Exponents 122; 4.10.3 The Fibonacci Series 123; 4.11 Types of Recursion 123; 4.11.1 Direct Recursion 123; 4.11.2 Indirect Recursion 123; 4.11.3 Tail Recursion 123; 4.11.4 Linear and Tree Recursion 124; 4.12 Tower of Hanoi 124; 4.13 Recursion Versus Iteration 126; Annexure 2 133; 5 Arrays; 5.1 Introduction 134; 5.2 Declaration of Arrays 135; 5.3 Accessing the Elements of an Array 136; 5.3.1 Calculating the Address of Array Elements 136; 5.3.2 Calculating the Length of an Array 137; 5.4 Storing Values in Arrays 137; 5.4.1 Initializing Arrays during Declaration 137; 5.4.2 Inputting Values from the Keyboard 138; 5.4.3 Assigning Values to Individual Elements 138; 5.5 Operations on Arrays 138; 5.5.1 Traversing an Array 139; 5.5.2 Inserting an Element in an Array 144; 5.5.3 Deleting an Element from an Array 146; 5.5.4 Merging Two Arrays 148; 5.5.5 Searching for a Value in an Array 150; 5.6 Passing Arrays to functions 153; 5.7 Two-dimensional Arrays 156; 5.7.1 Declaring Two-dimensional Arrays 156; 5.7.2 Initializing Two-dimensional Arrays 158; 5.7.3 Accessing the Elements of Two-dimensional Arrays 158; 5.8 Operations on Two-dimensional Arrays 161; 5.9 Passing Two-Dimensional Arrays to Functions 164; 5.9.1 Passing a Row 164; 5.9.2 Passing an Entire 2D Array 165; 5.10 Multidimensional Arrays 167; 5.11 Sparse Matrices 168; 5.11.1 Array Representation of Sparse Matrices 169; 5.12 Applications of Arrays 170; Case Study 2: Chapter 5 175; 6 Strings; 6.1 Introduction 180; 6.1.1 Reading Strings 182; 6.1.2 Writing Strings 182; 6.1.3 Summary of Functions Used to Read and Write Characters 183; 6.2 Suppressing Input 184; 6.2.1 Using a Scanset 184; 6.3 String Taxonomy 185; 6.4 Operations on Strings 186; 6.4.1 Finding the Length of a String 186; 6.4.2 Converting Characters of a String into Upper Case 187; 6.4.3 Converting Characters of a String Into Lower Case 188; 6.4.4 Concatenating Two Strings to Form a New String 188; 6.4.5 Appending a String to Another String 189; 6.4.6 Comparing two strings 189; 6.4.7 Reversing a String 190; 6.4.8 Extracting a Substring from Left 191; 6.4.9 Extracting a Substring from Right of the String 192; 6.4.10 Extracting a Substring from the Middle of a String 192; 6.4.11 Inserting a String in Another String 193; 6.4.12 Indexing 194; 6.4.13 Deleting a String from the Main String 194; 6.4.14 Replacing a Pattern with Another Pattern in a String 195; 6.5 Miscellaneous String and Character Functions 196; 6.5.1 Character Manipulation Functions 196; 6.5.2 String Manipulation Functions 196; 6.6 Arrays of Strings 202; 7 Pointers; 7.1 Understanding the Computers Memory 213; 7.2 Introduction to Pointers 214; 7.3 Declaring Pointer Variables 215; 7.4 Pointer Expressions and Pointer Arithmetic 217; 7.5 Null Pointers 221; 7.6 Generic Pointers 222; 7.7 Passing Arguments to Function Using Pointers 222; 7.8 Pointers and Arrays 223; 7.9 Passing an Array to a Function 227; 7.10 Difference Between Array Name and Pointer 228; 7.11 Pointers and Strings 229; 7.12 Arrays of Pointers 232; 7.13 Pointers and 2D Arrays 234; 7.14 Pointers and 3D Arrays 236; 7.15 Function Pointers 237; 7.15.1 Initializing a Function Pointer 237; 7.15.2 Calling a Function Using a Function Pointer 237; 7.15.3 Comparing Function Pointers 238; 7.15.4 Passing a Function Pointer as an Argument to a Function 238; 7.16 Array of Function Pointers 238; 7.17 Pointers to Pointers 239; 7.18 Memory Allocation in C Programs 240; 7.19 Memory Usage 240; 7.20 Dynamic Memory Allocation 240; 7.20.1 Memory Allocations Process 241; 7.20.2 Allocating a Block of Memory 241; 7.20.3 Releasing the Used Space 242; 7.20.4 To Alter the Size of Allocated Memory 242; 7.21 Drawbacks of Pointers 244; Annexure 3 253; Case Study 3: Chapter 6 and 7 256; 8 Structure, Union, and Enumerated Data Types; 8.1 Introduction 259; 8.1.1 Structure Declaration 259; 8.1.2 Typedef Declarations 261; 8.1.3 Initialization of Structures 261; 8.1.4 Accessing the Members of a Structure 262; 8.1.5 Copying and Comparing Structures 262; 8.2 Nested Structures 265; 8.3 Arrays of Structures 266; 8.4 Structures and Functions 268; 8.4.1 Passing Individual Members 268; 8.4.2 Passing the Entire Structure 268; 8.4.3 Passing Structures Through Pointers 271; 8.5 Self-referential Structures 276; 8.6 Unions 276; 8.6.1 Declaring a Union 276; 8.6.2 Accessing a Member of a Union 277; 8.6.3 Initializing Unions 277; 8.7 Arrays of Union Variables 278; 8.8 Unions Inside Structures 278; 8.9 Structures Inside Unions 279; 8.10 Enumerated Data Type 279; 8.10.1 enum Variables 280; 8.10.2 Using the Typedef Keyword 281; 8.10.3 Assigning Values to Enumerated Variables 281; 8.10.4 Enumeration Type Conversion 281; 8.10.5 Comparing Enumerated Types 281; 8.10.6 Input/Output Operations on Enumerated Types 281; Annexure 4 288; 9 Files; 9.1 Introduction to Files 290; 9.1.1 Streams in C 290; 9.1.2 Buffer Associated with File Stream 291; 9.1.3 Types of Files 291; 9.2 Using Files in C 292; 9.2.1 Declaring a File Pointer Variable 292; 9.2.2 Opening a File 292; 9.2.3 Closing a File Using fclose () 294; 9.3 Read Data From Files 294; 9.3.1 fscanf () 294; 9.3.2 fgets () 295; 9.3.3 fgetc () 296; 9.3.4 fread () 296; 9.4 Writing Data to Files 297; 9.4.1 fprintf () 297; 9.4.2 fputs () 299; 9.4.3 fputc () 299; 9.4.4 fwrite () 299; 9.5 Detecting the End-of-file 300; 9.6 Error Handling During File Operations 301; 9.6.1 clearerr() 301; 9.6.2 perror () 302; 9.7 Accepting Command Line Arguments 302; 9.8 Functions for Selecting a Record Randomly 316; 9.8.1 fseek () 316; 9.8.2 ftell () 318; 9.8.3 rewind () 318; 9.8.4 fgetpos () 319; 9.8.5 fsetpos () 319; 9.9 remove () 320; 9.10 Renaming the File 320; 9.11 Creating a Temporary File 320; 10 Preprocessor Directives; 10.1 Introduction 325; 10.2 Types of Preprocessor Directives 325; 10.3 #define 326; 10.3.1 Object-like Macro 326; 10.3.2 Function-like Macros 327; 10.3.3 Nesting of Macros 328; 10.3.4 Rules for Using Macros 328; 10.3.5 Operators Related to Macros 328; 10.4 #include 329; 10.5 #undef 330; 10.6 #line 330; 10.7 Pragma Directives 331; 10.8 Conditional Directives 333; 10.8.1 #ifdef 333; 10.8.2 #ifndef 333; 10.8.3 #if Directive 334; 10.8.4 #else Directive 334; 10.8.5 #elif Directive 334; 10.8.6 #endif Directive 335; 10.9 Defined Operator 335; 10.10 #error directive 336; 10.11 Predefined Macro Names 336; Annexure 5 340; 11 Linked Lists; 11.1 Introduction 344; 11.2 Linked Lists Versus Arrays 345; 11.3 Memory Allocation and Deallocation for a Linked List 346; 11.4 Different Types of Linked Lists 347; 11.5 Singly Linked Lists 348; 11.5.1 Traversing a Singly Linked List 348; 11.5.2 Searching for a Value in a Linked List 348; 11.5.3 Inserting a New Node in a Linked List 349; 11.6 Circular Linked Lists 357; 11.7 Doubly Linked Lists 358; 11.8 Circular Doubly Linked Lists 359; 11.9 Header Linked Lists 359; 11.10 Applications of Linked Lists 360; Case Study 4: Chapter 8, 9, and 11 366; 12 Stacks and Queues; 12.1 Stacks 369; 12.2 Array Representation of Stacks 370; 12.3 Operations on Stacks 370; 12.3.1 Push Operation 371; 12.3.2 Pop Operation 371; 12.3.3 Peep Operation 371; 12.4 Applications of Stacks 373; 12.4.1 Evaluation of Algebraic Expressions 373; 12.5 Queues 380; 12.6 Array Representation of Queues 380; 12.7 Operations on Queues 380; 12.8 Applications of Queues 382; Case Study 5: Chapters 11 and 12 366; 13.; 13 Trees; 13.1 Binary Trees 391; 13.1.1 Key Terms 392; 13.1.2 Complete Binary Trees 393; 13.1.3 Extended Binary Trees 393; 13.1.4 Representation of Binary Trees in Memory 394; 13.2 Expression Trees 395; 13.3 Traversing a Binary Tree 396; 13.3.1 Pre-order Algorithm 396; 13.3.2 In-order Algorithm 397; 13.3.3 Post-order Algorithm 398; 13.3.4 Level-order Traversal 398; 13.4 Applications of Trees 398; Case Study 6: Chapter 13 403; 14 Graphs; 14.1 Introduction 407; 14.1.1 Why Graphs are Useful? 407; 14.1.2 Definition 407; 14.1.3 Graph Terminology 408; 14.1.4 Directed Graphs 409; 14.2 Representation of Graphs 409; 14.2.1 Adjacency Matrix Representation 409; 14.2.2 Adjacency List 411; 14.3 Graph Traversal Algorithms 413; 14.3.1 Breadth-first Search 413; 14.3.2 Depth-first Search Algorithm 415; 14.4 Applications of Graphs 417; Case Study 7: Chapter 14 421; 15 Developing Efficient Programs; 15.1 Modularization 426; 15.2 Design and Implementation of Efficient Programs 427; 15.2.1 Requirements Analysis 428; 15.2.2 Design 428; 15.2.3 Implementation 428; 15.2.4 Testing 428; 15.2.5 Software Deployment, Training, and Support 428; 15.2.6 Maintenance 428; 15.3 Program Design Tools: Algorithms, Flowcharts, Pseudocodes 429; 15.3.1 Algorithms 429; 15.3.2 Flowcharts 430; 15.3.3 Pseudocode 431; 15.4 Types of Errors 431; 15.4.1 Testing and Debugging Approaches 432; Appendix A: Versions of C 436; Appendix B: ASCII Chart of Characters 441; Appendix C: ANSI C Library Functions 443; Appendix D: Type Qualifiers and Inline Functions 450; Appendix E: Bit-level Programming and Bitwise Shift Operators 454; Appendix F: Answers to Objective Questions 457
Trade Policy 买家须知
- 关于产品:
- ● 正版保障:本网站隶属于中国国际图书贸易集团公司,确保所有图书都是100%正版。
- ● 环保纸张:进口图书大多使用的都是环保轻型张,颜色偏黄,重量比较轻。
- ● 毛边版:即书翻页的地方,故意做成了参差不齐的样子,一般为精装版,更具收藏价值。
关于退换货:
- 由于预订产品的特殊性,采购订单正式发订后,买方不得无故取消全部或部分产品的订购。
- 由于进口图书的特殊性,发生以下情况的,请直接拒收货物,由快递返回:
- ● 外包装破损/发错货/少发货/图书外观破损/图书配件不全(例如:光盘等)
并请在工作日通过电话400-008-1110联系我们。
- 签收后,如发生以下情况,请在签收后的5个工作日内联系客服办理退换货:
- ● 缺页/错页/错印/脱线
关于发货时间:
- 一般情况下:
- ●【现货】 下单后48小时内由北京(库房)发出快递。
- ●【预订】【预售】下单后国外发货,到货时间预计5-8周左右,店铺默认中通快递,如需顺丰快递邮费到付。
- ● 需要开具发票的客户,发货时间可能在上述基础上再延后1-2个工作日(紧急发票需求,请联系010-68433105/3213);
- ● 如遇其他特殊原因,对发货时间有影响的,我们会第一时间在网站公告,敬请留意。
关于到货时间:
- 由于进口图书入境入库后,都是委托第三方快递发货,所以我们只能保证在规定时间内发出,但无法为您保证确切的到货时间。
- ● 主要城市一般2-4天
- ● 偏远地区一般4-7天
关于接听咨询电话的时间:
- 010-68433105/3213正常接听咨询电话的时间为:周一至周五上午8:30~下午5:00,周六、日及法定节假日休息,将无法接听来电,敬请谅解。
- 其它时间您也可以通过邮件联系我们:customer@readgo.cn,工作日会优先处理。
关于快递:
- ● 已付款订单:主要由中通、宅急送负责派送,订单进度查询请拨打010-68433105/3213。
本书暂无推荐
本书暂无推荐