C语言教程(英文版·第4版)
作者 : (美)Al Kelley,Ira Pohl
丛书名 : 经典原版书库
出版日期 : 2004-01-01
ISBN : 7-111-13414-1
定价 : 65.00元
教辅资源下载
扩展信息
语种 : 英文
页数 : 726
开本 : 16开
原书名 : A Book on C: Programming in C
原出版社: Addison-Wesley
属性分类: 教材
包含CD :
绝版 :
图书简介

本书是ANSI C程序设计语言的最畅销的教材和参考书之一。第4版继承了前几版的许多优点,改进、 更新和扩展了C的范围,并包含了如何从C过渡到Java和C++的相关知识。
  初学者和专业程序员都可以借助本书提供的大量示例和练习深入理解书中讲解的每个概念。作者通过 循序渐进地解析程序代码,阐明了C语言结构的正确使用和语法,并揭示出其应用的基础逻辑。全书阐述清晰、层次分明,是一本全面论述C语言的权威著作。
  
本书特色
  新增和更新了编程示例和相关解析——这是本书作者用来说明和讲授语言概念的标志性的技巧。 正文论述和练习经过反复推敲,突出了递归的重要性。
  对多文件编程给予更大的关注,因为这是关系到正确性和类型安全的一些问题。对函数模型的使 用贯穿全书。
  详细论述了抽象数据类型,这是对于理解对象来说必不可少的关键概念。
  更新了相关资料,讲述如何从C过渡到C++以及Java,其中包括面向对象程序设计的重要概念。 以简单表格的形式列出C的关键函数和特征,供读者参考。

图书特色

Ira PohI是美国加州大学圣克鲁兹分校计算机科学技术系教授,具有20多年软件教学经验,是C和C++语言程序设计的国际权威,著有多部与C和C++语言有关的经典著作(其中,《C++精粹》和《C语言解析教程》已经由
机械工业出版社翻译出版)。他曾为多家机构提供技术咨询服务,包括DEC公司、苹果公司、斯坦福线形加速器研究中心、Xylinx和Gupta公司等。

图书前言

A Book on C conveys an appreciation for both the elegant simplicity and the power of this general-purpose programming language. By presenting interactive running programs from many application areas, this book describes the ANSI version of the C language. The complete language is presented in a step-by-step manner, along with many complete working programs.
  Where appropriate, we discuss the differences between traditional C and ANSI C.(Traditional C still remains in wide use.) Dozens of example programs are available to illustrate each important language feature, and many tables summarize key information and provide easy access for later reference. Each chapter ends with a summary and exercises. The summary reviews key elements presented in the chapter, and the exercises augment and extend the text.
  This book assumes a general-purpose knowledge of the C language. It is intended for use in either a first or second programming course. However, it can be readily used in conjunction with courses on topics such as comparative programming languages, computational linguistics, data structures, database systems, fractal geometry, graphics,numerical analysis, operating systems, programming methodology, and scientific applications. C is suitable for applications from each of these domains, and all features of Cneeded to code such applications are explained. This book is appropriate for a data structures course because advanced data structuring features such as enumeration types, unions, self-referential structures, and ragged arrays are discussed. For operatlng systems courses concerned with UNIX or Windows 95/NT, the book explores the file structure and systems routines that enable the C programmer to add to existing systerns libraries and understand the C code underlying the operating system. For applications programming and soentific programming, there is discussion of how to write sample function libraries. Statistics, root finding, sorting, text manipulation, file handling, and game playing are all represented with working code.
  New Java Section. In Chapter 14, "Moving from C to Java," we discuss how the C programmer can very naturally and easily begin programming in Java, a language of interest for work on the Internet. The Java programming language borrows ideas from both C and C++ and is designed to run in a machine-and system-independent manner. This makes it suitable for Internet work, such as writing applets for Web pages that get used by browsers. Because Java is an extension of C and C++, it is readily learned by the C programmer.
  Complete ANSI C Language. Computer professionals will have access to a complete treatment of the language, including enumeration types, list processing, and the operating system interface. Chapter 1, "An Overview of C," presents an overview of the language. After reading this chapter, the professional will already be able to write C code.
  Since the chapters are self-contained, the knowledgeable reader can skip to particular sections as needed. Chapter 11, "Input/Output and the Operating System," gives a thorough introduction to the connections to the operating system. This information will benefit the professional systems programmer needing to use C to work within an MSDOS or UNIX environment.
Interactive Environment. This book is written entirely with the modern interactive environment in mind. Experimentation is encouraged throughout. Keyboard and screen input/output is taken as the norm, and its attendant concerns are explained. Thus, the book is appropriate for users of small home and business computers as well as to users of large interactive systems. We assume that the reader will have access to an interac tive ANSI C system. During the writing of this book, we used a number of different C systems: various Borland and Microsoft compilers running on IBM-compatible Pentium machines, the GNU gcc compiler and native compilers running on various workstations from DEC, SGI, and Sun, and the C compiler that runs on the Cray supercomputer in San Diego.
Working Code. Our approach to describing the language 'is to use examples, explanation, and syntax. Working code is employed throughout. Small but useful examples are provided to describe important technical points. Small because small is comprehensible. Useful because programming is based on a hierarchy of building blocks and ultimately is pragmatic. The programs and functions described in the book can be used in actual systems. The authors' philosophy is that one should experiment and enjoy.
  Dissections. We use highlighted "dissections" on many programs and functions throughout the book. Dissection is a unique pedagogical tool first developed by the authors in 1984 to illuminate key features of working code. A dissection is similar to a structured walk-through of the code. Its intention is to explain to the reader newly encountered programming elements and idioms found in working code.
  Flexible Organization. This book is constructed to be very flexible in its use. Chapter 1,
"An Overview of C," is in two parts. The first part explains the crucial programming techniques needed for interactive input/output, material that must be understood by all. The second part of Chapter 1 goes on to survey the entire language and will be comprehensible to experienced programmers familiar with comparable features from other languages. This second part can be postponed in a first programming course. Caution:Beginning programmers should postpone the second part of Chapter 1.
  Chapter 2, "Lexical Elements, Operators, and the C System," describes the lexical level of the language and syntactic rules, which are selectively employed to illustrate C language constructs. The instructor may decide to teach Backus-Naur-Form (BNF) notation as described in Chapter 2 or may omit it without any loss of continuity. The book uses BNF-style syntactic descriptions so that the student can learn this standard form of programming language description. In addition, language components are thoroughly described by example and ordinary explanation.
  
Reference Work.
  This book is designed to be a valuable reference to the C language.Throughout the book, many tables concisely illustrate key areas of the language. The complete ANSI C standard library, along with its associated header files, is described in the Appendix A, "The Standard Library." Sections in the appendix are devoted to explaining each of the standard header files such as ctype, h, stdio, h, and string, h. Where appropriate, example code is given to illustrate the use of a particular construct or function.
  In Appendix B, "Language Syntax," we provide the complete syntax of the C language.In Appendix C, "ANSI C Compared to Traditional C," we list the major differences between ANSI C and traditional C. Finally, special care has been taken to make the index easy to use and suitable for a reference work.
The Complete ANSI C Language. Chapters 3 through 10 cover the C language feature by feature. Many advanced topics are discussed that may be omitted on first reading without loss of comprehension, if so desired. For example, enumeration types are relatively new to the language, and their use can be omitted in a first course. Machine dependent features such as word size considerations and floating-point representation are emphasized, but many of the details need not concern the beginner.     
  The Preprocessor. Chapter 8, "The Preprocessor," is devoted entirely to the preproeessor, which is used to extend the power and notation of the C language. Macros can be used to generate inline code that takes the place of a function call. Their use can reduce program execution time. The chapter presents a detailed discussion of the preprocessor, including new features added by the ANSI committee. In traditional C, the preprocessor varies considerably from one compiler to another. In ANSI C, the functionality of the preprocessor has been completely specified.
  Recursion and List Processing. Chapter 5, "Functions," has a careful discussion of recursion, which is often a mystifying topic for the beginner. The use of recursion is illustrated again in Chapter 8, "The Preprocessor," with the quicksort algorithm and in Chapter 10, "Structures and List Processing," with basic list processing techniques. A thorough knowledge of list processing techniques is necessary in advanced programming and data structure courses.
  Operating System Connection. Chapter 11, "Input/Output and the Operating System,"makes the operating system connection. In this chapter, we explain how to do file processing and discuss at length the various input/output functions in the standard library. We also explain how to execute a system command from within a C program and how to set file permissions and use of environment variables. We give explicit examples showing the use of the profiler, the librarian, and the make facility.
  Advanced Applications. We discuss a number of advanced applications in Chapter 12,"Advanced Applications." We present topics such as creating concurrent processes,overlaying a process, interprocess communication, and signals, along with working code. Also, we discuss the dynamic allocation of vectors and matrices for engineers and scientists. These advanced topics can be used selectively according to the needs of the audience: They could form the basis for an excellent second course in programming practice. This book can be used, too, as an auxihary text in advanced computer science courses that employ C as their implementation language.Tables, Summaries, and Exercises. Throughout the book are many tables and lists that succinctly summarize key ideas. These tables aid and test language comprehension. For example, C is very rich in operators and allows almost any useful combination of operator mix. It is essential to understand order of evaluation and association of each of these operators separately and in combination. These points are illustrated in tables throughout the text. As a reference tool, the tables and code are easily looked up.
  The exercises test elementary features of the language and discuss advanced and system-dependent features. Many exercises are oriented to problem solving, others test the reader's syntactic or Semantic understanding of C. Some exercises include a tutorial discussion that is tangential to the text but may be of special interest to certain readers.The exercises offer the instructor all levels of question, so as to allow assignments suitable to the audience.


图书目录

PrefaCe
Chapter 0
Starting from Zero
0.1  Why C
0.2  ANSI C Standard
0.3  From C to C++
0.4  From C and C++to java
Chapter 1
An Overview of C
1.1  Programming and Preparation
1.2  Program Output
1.3  Variables,Expressions,and Assignment
1.4  The Use of #define and #include
1.5  The USe of printf()and Scanf()
1.6  Flow of Control
1.7  Functions
Call-by-value
1. 8  ArrayS,Strings,and Pointers
Arrays
Strings
Pointers
1.9  Files
1.10 Operating System Considerations
Writing and Running a C Program
Interrupting a Program
Typing an End-of-file Signal
Redirection of the Input and the Output
Summary
Exercises
Chapter 2
Lexical Elements, Operators, and the C System
2.1  Characters and Lexical Elements
2.2  Syntax Rules
2.3  Comments
2.4  Keywords
2.5  Identifiers
2.6  Constants
2.7  String Constants
2.8  Operators and Punctuators
2.9  Precedence and Associativity of Operators
2.10 Increment and Decrement Operators
2.11 Assignment Operators
2.12 An Example: Computing Powers of 2
2.13 The C System
The Preprocessor
The Standard Library
Summary
Exercises
Chapter 3
The Fundamental Data Types
3.1  Declarations, Expressions, and Assignment
3.2  The Fundamental Data Types
3.3  Characters and the Data Type char
3.4  The Data Type int
3.5  The integral Types short, long, and unsigned
3.6  The Floating Types
3.7  The Use of typedef
3.8  The sizeof Operator
3.9  The Use of getchar() and putchar()
3.10 Mathematical Functions
The Use of abs() and fabs()
UNIX and the Mathematics Library
3.11 Conversions and Casts
The Integral Promotions
The Usual Arithmetic Conversions
Casts
3.12 Hexadecimal and Octal Constants
C.13 Summary
Exercises
Chapter 4
Flow of Control
4.1  Relational, Equality, and Logical Operators
4.2  Relational Operators and Expressions
4.3  Equality Operators and Expressions
4.4  Logical Operators and Expressions
Short-circuit Evaluation
4.5  The Compound Statement
4.6  The Expression and Empty Statement
4.7  The if and the if-else Statements
4.8  The while Statement
4.9  The for Statement
4.10 An Example: Boolean Variables
4.11 The Comma Operator
4.12 The do Statement
4.13 An Example: Fibonacci Numbers
4.14 The goto Statement
4.15 The break and continue Statements
4.16 The switch Statement
4.17 The Conditional Operator
Summary
Exercises
Chapter 5
Functions
5.1  Function Definition
5.2  The return Statement
5.3  Function Prototypes
Function Prototypes in C++
5.4  An Example: Creating a Table of Powers
5.5  Function Declarations from the Compiler's Viewpoint
Limitations
5.6  An Alternate Style for Function Definition Order
5.7  Function Invocation and Call-by-Value
5.8  Developing a Large Program
What Constitutes a Large Program
5.9  Using Assertions
5.10 Scope Rules
Parallel and Nested Blocks
Using a Block for Debugging
5.11 Storage Classes
The Storage Class auto
The Storage Class extern
The Storage Class register
The Storage Class static
5.12 Static External Variables
5.13 Default Initialization
5.14 Recu rsion
Efficiency Considerations
5.15 An Example: The Towers of Hanoi
Summary
Exercises
Chapter 6
Arrays, Pointers, and Strings
6.1  One-dimensional Arrays
Initialization
Subscripting
6.2  Pointers
6.3  Call-by-Reference
6.4  The Relationship Between Arrays and Pointers
6.5  Pointer Arithmetic and Element Size
6.6  Arrays as Function Arguments
6.7  An Example: Bubble Sort
6.8  Dynamic Memory Allocation With calloc() and malloc()
Offsetting the Pointer
6.9  An Example: Merge and Merge Sort
6.10 Strings
6.11 String-Handling Functions in the Standard Library
6.12 Multidimensional Arrays
Two-dimensional Arrays
The Storage Mapping Function
Formal Parameter Declarations
Three-dimensional Arrays
Initialization
The Use of typedef
6.13 Arrays of Pointers
6.14 Arguments to main()
6.15 Ragged Arrays
6.16 Functions as Arguments
Functions as Formal Parameters in Function Prototypes
6.17 An Example: Using Bisection to Find the Root of a Function
The Kepler Equation
6.18 Arrays of Pointers to Function
6.19 The Type Qualifiers const and volati 1 e
Summary
Exercises
Chapter 7
Bitwise Operators and Enumeration Types
7.1  Bitwise Operators and Expressions
Bitwise Complement
Two's Complement
Bitwise Binary Logical Operators
Left and Right Shift Operators
7.2  Masks
7.3  Software Tools: Printing an int Bitwise
7.4  Packing and Unpacking
Multibyte Character Constants
7.5  Enumeration Types
7.6  An Example: The Game of Paper, Rock, Scissors
Summary
Exercises
Chapter 8
The Preprocessor
8.1  The Use of #include
8.2  The Use of #define
Syntactic Sugar
8.3  Macros with Arguments
8.4  The Type Definitions and Macros in stddef, h
8.5  An Example: Sorting with qsort()
8.6  An Example: Macros with Arguments
8.7  The Macros in stdio, h and ctype.h
8.8  Conditional Compilation
8.9  The Predefined Macros
8.10 The Operators # and ##
8.11 The assert() Macro
8.1 2 The Use of #error and #pragma
8.1 3 Line Numbers
8.14 Corresponding Functions
8.15 An Example: Quicksort
Summary
Exercises
Chapter 9
Structures and Unions
9.1  Structures
9.2  Accessing Members of a Structure
9.3  Operator Precedence and Associativity: A Final Look
9.4  Using Structures with Functions
9.5  Initialization of Structures
9.6  An Example: Playing Poker
9.7  Unions
9.8  Bit Fields
9.9  An Example: Accessing Bits and Bytes
9.10 The ADT Stack
Summary
Exercises
Chapter 10
Structures and List Processing
10.1 Self-referential Structures
10.2 Linear Linked Lists
Storage Allocation
10.3 List Operations
10.4 Some List Processing Functions
Insertion
Deletion
10.5 Stacks
10.6 An Example: Polish Notation and Stack Evaluation
10.7 Queues
10.8 Binary Trees
Binary Tree Traversal
Creating Trees
10.9 General Linked Lists
Traversal
The Use of calloc() and Building Trees
Summary
Exercises
Chapter 1 1
Input/Output and the Operating System
1 1.1 The Output Function printfO
11.2 The Input FunctionscanfO
11.3 The FunctionsfprintfO, fscanf(),sprintfO,
and sscanf()
11.4 The Functionsfopen() and fcloseO
11.5 An Example: Double Spacing a File
11.6 Using Temporary Files and Graceful Functions
11.7 Accessing a File Randomly
11.8 File Descriptor Input/Output
11.9 File Access Permissions
11.10 Executing Commands from Within a C Program
11.11 Using Pipes from Within a C Program
11.12 Environment Variables
11.13 The C Compiler
11.14 Using the Profiler
11.15 Libraries
11.16 How to TimeCCode
11.17 The Use of make
11.18 The Use of touch
11.19 Other Useful Tools
Summary
Exercises
Chapter 12
Advanced Applications
12.1 Creating a Concurrent Process with fork()
12.2 Overlaying a Process: the exec... () Family
Using the spawn...() Family
12.3 Interprocess Communication Using pi pe()
12.4 Signals
1 2.5 An Example: The Dining Philosophers
1 2.6 Dynamic Allocation of Matrices
Why Arrays of Arrays Are Inadequate
Building Matrices with Arrays of Pointers
Adjusting the Subscript Range
Allocating All the Memory at Once
1 2.7 Returning the Status
Summary
Exercises
Chapter 13
Moving from C to C++
13.1 Output
13.2 Input
13.3 Functions
13.4 Classes and Abstract Data Types
13.5 Overloading
13.6 Constructors and Destructors
13.7 Object-oriented Programming and Inheritance
13.8 Polymorphism
13.9 Templates
13.10 C++ Exceptions
13.11 Benefits of Object-oriented Programming
Summary
Exercises
Chapter 14
Moving from C to Java
14.1 Output
14.2 Variables and Types
14.3 Classes and Abstract Data Types
14.4 Overloading
14.5 Construction and Destruction of Class Types
14.6 Object-oriented Programming and Inheritance
14.7 Polymorphism and Overriding Methods
14.8 Applets
14.9 Java Exceptions
14.10 Benefits of Java and OOP
Summary
Exercises
Appendix A
The Standard Library
A.1  Diagnostics: <assert.h>
A.2  Character Handling: <ctype. h>
Testing a Character
Mapping a Character
A.3 Errors: <errno. h>
A.4 Floating Limits: <float. h>
A.5 Integral Limits: <limits.h>
A.6 Localization: <locale.h>
A.7 Mathematics: <math. h>
A.8  Nonlocal Jumps: <setjmp. h>
A.9  Signal Handling: <signal .h>
A. 10 Variable Arguments: <stdarg.h>
A. 11 Common Definitions: <stddef.h>
A. 12 Input/Output: <stdio. h>
Opening, Closing, and Conditioning a File
Accessing the File Position Indicator
Error Handling
Character Input/Output
Formatted Input/Output
Direct Input/Output
Removing or Renaming a File
A.13 General Utilities:<stdlib.h>
Dynamic Allocation of Memory
Searching and Sorting
Pseudo Random-Number Generator
Communicating with the Environment
Integer Arithmetic
String Conversion
Multibyte Character Functions
Multibyte String Functions
Leaving the Program
A.14 Memory and String Handling: <string.h>
Memory-Handling Functions
String-Handling Functions
A.15 Date and Time: <time. h>
Accessing the Clock
Accessing the Time
A.16 Miscellaneous
File Access
Using File Descriptors
Creating a Concurrent Process
Overlaying a Process
Interprocess Communication
Suspending Program Execution
Appendix B
Language Syntax
B.1  Prog ram
B.2  Function Definition
B.3  Declaration
B.4  Statement
B.5  Expression
B.6  Constant
B.7  String Literal
B.8  Preprocessor
Appendix C
ANSI C Compared to Traditional C
C.1  Types
C.2  Constants
C.3  Declarations
C.4  Initializations
C.5  Expressions
C.6  Functions
C.7  Conversions
C.8  Array Pointers
C.9  Structures and Unions
C.10 Preprocessor
C.11 Header Files
C.12 Miscellaneous
Appendix D
ASCII Character Codes
Appendix E
Operator Precedence and Associativity
Index

教学资源推荐
作者: [美]H. H. 塔恩(H.H.Tan),T. B. 多拉齐奥(T.B.D'Orazio)[香港]柯兆恒(S. H. Or),玛丽安 M. Y. 周(Marian M. Y. Choy) 著
作者: 宋存利 张雪松 编著
作者: 刘燕君,刘振安,孙忱
参考读物推荐
作者: (美)凯 S.霍斯特曼(Cay S. Horstmann)著
作者: 吴永辉 王建德 杨溢 李明韫 等编著
作者: Patrick Henry Winston