出版時(shí)間:2009-5 出版社:(印)巴拉古路薩米 清華大學(xué)出版社 (2009-05出版) 作者:[印] 巴拉古路薩米 頁(yè)數(shù):543
Tag標(biāo)簽:無
前言
About the AuthorE Balagurusamy, former Vice Chancellor, Anna University, Chennai, is currently Member, Union Public Service Commission, New Delhi. He is a teacher, trainer, and consultant. in the fields of information TechnologV and Management. He holds an ME (Hons) in Electri.y and Management. He holds an ME (Hons) in Electrical Engineering and Ph.D. in Systems Engineering from the indian institute of Technology,Roorkee. His areas of interest include Object-Oriented Software Engineering, Electronic.ect-Oriented Software Engineering, ElectronicBusiness, Technology Management, Business Process Re-engineering, and Total QualityManagement.A prolific writer, he has authored a large number of research papers and several books.His best selling books, among others, include:. Programming in C#. Programming in Java, 3/e. Object-Oriented Programming with C++, 3/e.ect-Oriented Programming with C++, 3/e. Programming in BASIC, 3/e. Numerical Methods. Reliability Engineeringy EngineeringA recipient of numerous honours and awards, he has been listed in the Directory of Who'sWho of intellectuals and in the Directory of Distinguished Leaders in Education.Preface to the FourthEditionCis a powerful, flexible, portable and elegantly structured programming language. SinceC combines the features of high-level language with the elements of the assembler, it issuitable for both systems and applications programming. It is undoubtedly the most widelyJ .terns and applications programming. It is undoubtedly the most widelyused general-purpose language today.Since its standardization in 1989, C has undergone a series of changes and improvements.fi,,,n,n,,,m 1'l - if',, - 1in order to enhance the usefulness of the language. The version that incorDorates the newo or porates the newfeatures is now referred to as C99. The fourth edition of ANSI C has been thoroughly revisedand enlarged not only to incorporate the numerous suggestions received both from teachersand students across the country but also to highlight the enhancements and new featuresadded by C99.J u99.Organization of the bookThe book starts with an overview of C, which talks about the history of C, basic structure ofC programs and their execution. The second chapter discusses how to declare the constants,variables and data types. The third chapter describes the built-in operators and how to buildypes. The third chapter describes the built-in operators and how to build.. expressions using them. The fourth chapter details the input and output operations. Deci.1.111..1 .1.1 ~ fry n j ~ 11if.Ill 1sion making and branching is discussed in the fifth chapter, which talks about the if-else,o and branching is discussed in the fifth chapter, which talks about the if-else,switch and goto statements. Further, decision making and looping is discussed in Chapter.1.11. 111 - "l^111,n 1llJsix. which covers while. do and for fooDs. Arrays and ordered arrangement of data elements, which covers while, do and for loops. Arrays and ordered arrangement of data elements.are important to any programming language and have been covered in chapters seven andeight. Strings are also covered in Chapter eight. Chapters nine and ten are on functions,structures and unions. Pointers, perhaps the most difficult part of C to understand, iscovered in Chapter eleven in the most user-friendly manner. Chapters twelve and thirteenare on file management and dynamic memory allocation respectively. Chapter fourteen dealswith the preprocessor, and finally Chapter 15 is on developing a C program, which provides..,l,11. I - 11,Inm 11'l .1 1an insight on how to Droceed with develODment of a Drogram. The above organization would.lit on how to proceed with development of a program. The above organization wouldhelp the students in understanding C better if followed appropriately.Xii PrefaceNew to the editionThe content has been revised keeping the updates which have taken placed in the field of Cprogramming and the present day syllabus needs. As always, the concept of 'learning byexample' has been stressed throughout the book. Each major feature of the language istreated in depth followed by a complete program example to illustrate its use. The sampleprograms are meant to be both simple and educational. Two new projects are added at theend of the book for students to go through and try on their own.Each chapter includes a section at the beginning to introduce the topic in a proper perspective. It also provides a quick look into the features that are discussed in the chapter.Wherever necessary, pictorial descriptions of concepts are included to improve clarity and tofacilitate better understanding. Language tips and other special considerations are highlighted as notes wherever essential. In order to make the book more user-friendly, we haveincorporated the following key features.O Codes with comments are provided throughout the book to illustrate how the various features of the language are put together to accomplish specified tasks.O SuPPlementrrry imp~rrtion abed notes that complement but stand apart from thegeneral text have been included in boxes.O Guidelines for developing efficient C programs are given in the last chapter, togetherwith a list of some common mistookes that a less experienced C programmer couldmake.O Cause steadies at the end of the chapters illustrate common ways C features are puttogether and also show real-life applications.O The Joest Remember section at the end of the chapters lists out helpful hints andpossible problem areas.O Numerous chapter-end questions and exercises provide ample opportunities to thereaders to review the concepts learned and to practice their applications.O Progrrrmming projects discussed in the appendix give insight on how to integratethe various features of C when handling large programs.Supplementary MntertulWith this revision we have tried to enhance the online learning center too. The supplementary material would include the following:For the instructorQ Solutions to the debugging exercisesFor the StudentQ Exclusive project for implementation with code, step-by-step description and usermanualQ Code for the two projects (given in the book)U Two mini projectsQ Reading material on CThis book is designed for all those who wish to be C programmers, regardless of their pastknowledge and experience in programming. It explains in a simple and easy-to-understandstyle the what, why and how of programming with ANSI C.
內(nèi)容概要
本書旨在教授讀者如何使用C語言進(jìn)行程序設(shè)計(jì)。全書貫徹了“用示例學(xué)習(xí)”的概念。在深入介紹了C語言的每個(gè)特性之后,給出了一個(gè)完整的示例程序,用于演示說明其應(yīng)用。每章末尾的“案例學(xué)習(xí)”不僅介紹了把C語言的特性集成在一起的常用方法,而且還顯示了它在實(shí)際生活中的應(yīng)用。最后一章介紹了開發(fā)高效、無錯(cuò)誤的C程序的一些指導(dǎo)原則?! ”緯谇耙话娴幕A(chǔ)上增加介紹了C99的一些新特性,并增加了不少?gòu)?fù)習(xí)題和項(xiàng)目設(shè)計(jì)題,而且在附錄IV中給出了4個(gè)完整的應(yīng)用程序開發(fā)示例,使得本書的實(shí)際應(yīng)用性更強(qiáng)。
作者簡(jiǎn)介
作者:巴拉古路薩米
書籍目錄
第1章 C語言概述第2章 常量、變量及數(shù)據(jù)類型第3章 運(yùn)算符與表達(dá)式第4章 輸入輸出操作管理第5章 判斷與分支第6章 判斷與循環(huán)第7章 數(shù)組第8章 字符數(shù)組與字符串 第9章 自定義函數(shù)第10章 結(jié)構(gòu)與聯(lián)合第11章 指針第12章 文件管理第13章 動(dòng)態(tài)內(nèi)存分配與鏈表第14章 預(yù)處理器第15章 C程序開發(fā)指導(dǎo)原則附錄I 位級(jí)程序設(shè)計(jì)附錄II附錄III附錄IV 項(xiàng)目設(shè)計(jì)附錄V C99的特性Preface to the Fourth Edition xilace to the Fourth Edition xi1 Overview of C 11.1 History of C 11.2 Importance of C 31.3 Sample Program 1: Printing a Message 31.4 Sample Program 2: Adding Two Numbers 61.5 Sample Program 3: Interest Calculation 81.6 Sample Program 4: Use of Subroutines 101.7 Sample Program 5: Use of Math Functions 111.8 Basic Structure of C Programs 121.9 Programming Style 141.10 Executing a 'C' Program 141.11 Unix System 161.12 Ms-Dos System 18Review Questions 19Programming Exercises 202 Constants, Variables, and Data Types 232.1 Introduction 232.2 Character Set 232.3 C Tokens 252.4 KeyWords and identifiers 25y words and ldentiners 252.5 Constants 262.6 Variables 302.7 Data Types 31~'2.8 Declaration of Variables 342.9 Declaration of Storage Class 372.10 Assigning Values to Variables 382.11 Defining Symbolic Constants 442.12 Declaring a Variable as Constant 452.13 Declaring a Variable as Volatile 45Vi Contents2.14 Overflow and Underflow of Data 46Review Questions 49Programming Exercises 513 Operators and Expressions 523.1 Introduction 523.2 Arithmetic Operators 523.3 Relational Operators 553.4 Logical Operators 573.5 Assignment Operators 573.6 Increment and Decrement Operators 593.7 Conditional Operator 613.8 Bitwise Operators 613.9 Special Operators 613.10 Arithmetic Expressions 633.11 Evaluation of Expressions 643.12 Precedence of Arithmetic Operators 653.13 Some Computational Problems 673.14 Type Conversions in Expressions 683.15 Operator Precedence and Associativity 723.16 Mathematical Functions 74Review Questions 78Programming Exercises 814 Managing input and Output Operations 844.1 Introduction 844.2 Reading a Character 854.3 Writing a Character 884.4 Formatted input 894.5 Formatted Output 98Review Questions 110Programming Exercises 1125 Decision Making and Branching 1145.1 Introduction 1145.2 Decision Making with iF Statement 1145.3 Simple iF Statement 1155.4 The IF.....ELSE Statement 1195.5 Nesting of IF....ELSE Statements 1225.6 The ELSE IF Ladder 1265.7 The Switch Statement 1295.8 The ?' Operator 1335.9 The GOTO Statement 136Review Questions 144Programming Exercises 148Contents Vii6 Decision Making and Looping 1526.1 Introduction 1526.2 The WHILE Statement 1546.3 The DO Statement 1576.4 The FOR Statement 1596.5 Jumps in LOOPS 1666.6 Concise Test Expressions 174Review Questions 182Programming Exercises 1867 Arrays 1907.1 Introduction 1907.2 One-dimensional Arrays 1927.3 Declaration of One-dimensional Arrays 1937.4 Initialization of One-dimensional Arrays 1957.5 Two-dimensional Arrays 1997.6 Initializing Two-dimensional Arrays 2047.7 Multi-dimensional Arrays 2087.8 Dynamic Arrays 2097.9 More about Arrays 209Review Questions 223Programming Exercises 2258 Character Arrays and Strings 2298.1 Introduction 2298.2 Declaring and initializing String Variables 2308.3 Reading Strings from Terminal 2318.4 Writing Strings to Screen 2368.5 Arithmetic Operations on Characters 2418.6 Putting Strings Together 2428.7 Comparison of Two Strings 2448.8 String-handling Functions 2448.9 Table of Strings 2508.10 Other Features of Strings 252Review Questions 257Programming Exercises 2599 User-defined Functions 2629.1 Introduction 2629.2 Need for User-defined Functions 2629.3 A Multi-function Program 2639.4 Elements of User-defined Functions 2669.5 Definition of Functions 2679.6 Return Values and their Types 2699.7 Function Calls 2709.8 Function Declaration 272Vin Contents9.9 Category of Functions 2749.10 No Arguments and no Return Values 2749.11 Arguments but no Return Values 2779.12 Arguments with Return Values 2809.13 No Arguments but Returns a Value 2849.14 Functions that Return Multiple Values 2859.15 Nesting of Functions 2869.16 Recursion 2889.17 Passing Arrays to Functions 2899.18 Passing Strings to Functions 2949.19 The Scope, Visibility and Lifetime of Variables 2959.20 Multifile Programs 305Review Questions 311Programming Exercises 31510 Structures and Unions 31710.1 Introduction 31710.2 Defining a Structure 31710.3 Declaring Structure Variables 31910.4 Accessing Structure Members 32110.5 Structure initialization 32210.6 Copying and Comparing Structure Variables 32410.7 Operations on individual Members 32610.8 Arrays of Structures 32710.9 Arrays within Structures 32910.10 Structures within Structures 33110.11 Structures and Functions 33310.12 Unions 33510.13 Size of Structures 33710.14 Bit Fields 337Review Questions 344Programming Exercises 34811 Pointers 35111.1 Introduction 35111.2 Understanding Pointers 35111.3 Accessing the Address of a Variable 35411.4 Declaring Pointer Variables 35511.5 Initialization of Pointer Variables 35611.6 Accessing a Variable through its Pointer 35811.7 Chain of Pointers 36011.8 Pointer Expressions 36111.9 Pointer increments and Scale Factor 36211.10 Pointers and Arrays 36411.11 Pointers and Character Strings 36711.12 Array of Pointers 369Contents iX11.13 Pointers as Function Arguments 37011.14 Functions Returning Pointers 37311.15 Pointers to Functions 37311.16 Pointers and Structures 37611.17 Troubles with Pointers 379Review Questions 385Programming Exercises 38812 File Management in C 38912.1 Introduction 38912.2 Defining and Opening a File 39012.3 Closing a File 39112.4 Input/Output Operations on Files 39212.5 Error Handling During I/O Operations 39812.6 Random Access to Files 40012.7 Command Line Arguments 405Review Questions 408Programming Exercises 40913 Dynamic Memory Allocation and Linked Lists 41113.1 Introduction 41113.2 Dynamic Memory Allocation 41113.3 Allocating a Block of Memory: MALLOC 41313.4 Allocating Multiple Blocks of Memory: CALLOC 41513.5 Releasing the Used Space: Free 41513.6 Altering the Size of a Block' REALLOC 41613.7 Concepts of Linked Lists 41713.8 Advantages of Linked Lists 42013.9 Types of Linked Lists 42113.10 Pointers Revisited 42213.11 Creating a Linked List 42413.12 Inserting an item 42813.13 Deleting an item 43113.14 Application of Linked Lists 433Review Questions 440Programming Exercises 44214 The Preprocessor 44414.1 Introduction 44414.2 Macro Substitution 44514.3 File inclusion 44914.4 Compiler Control Directives 45014.5 ANSI Additions 453Review Questions 456Programming Exercises 457X Contents15 Developing a C Program: Some Guidelines 45815.1 Introduction 45815.2 Program Design 45815.3 Program Coding 46015.4 Common Programming Errors 46215.5 Program Testing and Debugging 46915.6 Program Efficiency 471Review Questions 472Appendix i: Bit-level Programming 474Appendix II: ASCll Values of Characters 480Appendix ill: ANSI C Library Functions 482Appendix IV: Projects 486Appendix V: C99 Features 537Bibliography 545
章節(jié)摘錄
插圖:Use the size of operator to determine the size of a linked list. When using memory allocation functions malloc and calloc,test for a NULL pointer return value.Print appropriate message if the memory allocation fails.Never call memory allocation functions with a zero size. Release the dynamically allocated memory when it is no longer required to avoid any possible“memory leak".Using free function to release the memory not allocated dynamically with malloc or calloc is an error.Use of a invalid pointer with free may cause problems and,sometimes, system crash.Using a pointer after its memory has been released is an error. It is anerrortoassignthe return value from ma Hoc or calloc to anything other than a pointer.It is a logic error to set a pointer to NULL before the node has been released.The node is irretrieva6ly lost.It is an error to declare a self-referential structure without a structure tag. It is an error to release individually the elements of an array created with Calloc. It is a logic error to fail to set the link filed in the last node to null.1.Insertion in a Sorted ListThe task of inserting a value into the current location in a sorted linked list involves two operations:1.Finding the node before which the new node has to be inserted .We call this node as ‘Key node’.2.Creating a new node with the value to be inserted and inserting the new node by manipulating pointers appropriately.In order to illustrate the process of insertion,we use a sorted linked list created by th I create function discussed in Exemple 13.3.Figure 13.11 shows a complete program tha l creates a list (using sorted input data)and then inserts a given value into the correct plan using function insert.
編輯推薦
《標(biāo)準(zhǔn)C程序設(shè)計(jì)》第3版融入了過去10年中采用本書的學(xué)生和老師的很多反饋意見。本版的特點(diǎn)包括:l 基于最新的C語言標(biāo)準(zhǔn)。l 在本書的最后給出了4個(gè)完整的應(yīng)用程序開發(fā)示例。l 擴(kuò)展討論了C的指針。l 每章后面的“謹(jǐn)記”一節(jié)給出了很有用的編程提示以及可能容易出錯(cuò)的問題。l 20多個(gè)真實(shí)的開發(fā)案例,展示了C程序的設(shè)計(jì)過程。l 80多個(gè)程序設(shè)計(jì)范例,向讀者闡述了良好程序設(shè)計(jì)的基本原則。l 還有200多個(gè)復(fù)習(xí)題和150多個(gè)項(xiàng)目設(shè)計(jì)題??傊?,本書的語言簡(jiǎn)潔易懂,示例非常豐富且具有很強(qiáng)的實(shí)際指導(dǎo)意義,是一本很好的C語言程序設(shè)計(jì)的教材。
圖書封面
圖書標(biāo)簽Tags
無
評(píng)論、評(píng)分、閱讀與下載
標(biāo)準(zhǔn)C程序設(shè)計(jì) PDF格式下載