C Primer Plus(第6版 英文版 套装上下册)(异步图书出品)pdf下载

C Primer Plus(第6版 英文版 套装上下册)(异步图书出品)百度网盘pdf下载

作者:
简介:C Primer Plus(第6版 英文版 套装上下册)(异步图书出品)
出版社:
出版时间:2016-03
pdf下载价格:0.00¥

免费下载


书籍下载


内容介绍

编辑推荐

  经久不衰的C语言畅销经典教程
  针对C11标准进行全面更新
  上一版累计销量逾22万册
  C语言领域的作品

  本书是一本经过仔细测试、精心设计的完整C语言教程,它涵盖了C语言编程中的核心内容。本书作为计算机科学的经典著作,讲解了包含结构化代码和自顶向下设计在内的程序设计原则。
  与以前的版本一样,作者的目标仍旧是为读者提供一本入门型、条理清晰、见解深刻的C语言教程。作者把基础的编程概念与C语言的细节很好地融合在一起,并通过大量短小精悍的示例同时演示一两个概念,通过学以致用的方式鼓励读者掌握新的主题。
  每章末尾的复习题和编程练习题进一步强化了重要的信息,有助于读者消化那些难以理解的概念。本书采用了友好、易于使用的编排方式,不仅适合打算认真学习C语言编程的学生阅读,也适合那些精通其他编程语言,但希望更好地掌握C语言这门核心语言的开发人员阅读。
  本书在之前版本的基础之上进行了全新升级,它涵盖了C语言新的进展以及C11标准的详细内容。本书还提供了大量深度与广度齐备的教学技术和工具,来提高你的学习。
  本书包含如下内容:
  详细完整地讨论了C语言的基础特性和附加特性;
  清晰解释了使用C语言不同部分的时机,以及原因;
  通过简洁、简单的示例加强读者的动手练习,以帮助一次理解一两个概念;
  囊括了数百个实用的代码示例;
  每章末尾的复习题和编程练习可以检测你的理解情况。
  涵盖了C泛型编程,以提供大的灵活性。

内容简介

  《C Primer Plus(第6版)英文版》详细讲解了C语言的基本概念和编程技巧。
  《C Primer Plus(第6版)英文版》共17章。第1、2章介绍了C语言编程的预备知识。第3~15章详细讲解了C语言的相关知识,包括数据类型、格式化输入/输出、运算符、表达式、语句、循环、字符输入和输出、函数、数组和指针、字符和字符串函数、内存管理、文件输入输出、结构、位操作等。第16章、17章介绍C预处理器、C库和高级数据表示。本书以完整的程序为例,讲解C语言的知识要点和注意事项。每章末设计了大量复习题和编程练习,帮助读者巩固所学知识和提高实际编程能力。附录给出了各章复习题的参考答案和丰富的参考资料。
  《C Primer Plus(第6版)英文版》可作为C语言的教材,适用于需要系统学习C语言的初学者,也适用于巩固C语言知识或希望进一步提高编程技术的程序员。

作者简介

  Stephen Prata,在美国加州肯特菲尔得的马林学院教授天文、物理和计算机科学。他毕业于加州理工学院,在美国加州大学伯克利分校获得博士学位。他单独编写以及与他人合作编写的编程图书有十多本,其中包括C++Primer Plus和C Primer Plus,而且后者获得了计算机出版协会1990年度How—to计算机图书奖。

目录

1 Getting Ready 1
第1章 初识C语言
Whence C? / C语言的起源 1
Why C? / 选择C语言的理由 2
Design Features / 设计特性 2
Efficiency / 高效性 3
Portability / 可移植性 3
Power and Flexibility / 强大而灵活 3
Programmer Oriented / 面向程序员 3
Shortcomings / 缺点 4
Whither C? / C语言的应用范围 4
What Computers Do / 计算机能做什么 5
High-level Computer Languages and Compilers / 高级计算机语言和编译器 6
Language Standards / 语言标准 7
The First ANSI/ISO C Standard / 第1个ANSI/ISO C标准 8
The C99 Standard / C99标准 8
The C11 Standard / C11标准 9
Using C: Seven Steps / 使用C语言的几个步骤 9
Step 1: Define the Program Objectives / 第1步:定义程序的目标 10
Step 2: Design the Program / 第2步:设计程序 10
Step 3: Write the Code / 第3步:编写代码 11
Step 4: Compile / 第4步:编译 11
Step 5: Run the Program / 第5步:运行程序 12
Step 6: Test and Debug the Program / 第6步:测试和调试程序 12
Step 7: Maintain and Modify the Program / 第7步:维护和修改代码 13
Commentary / 说明 13
Programming Mechanics / 编程机制 13
Object Code Files, Executable Files, and Libraries / 目标代码文件、可执行文件和库 14
Unix System / Unix系统 16
The GNU Compiler Collection and the LLVM Project / GNU编译器集合和LLVM项目 18
Linux Systems / Linux系统 18
Command-Line Compilers for the PC / PC的命令行编译器 19
Integrated Development Environments (Windows) / 集成开发环境(Windows) 19
The Windows/Linux Option / Windows/Linux 21
C on the Macintosh / Macintosh中的C 21
How This Book Is Organized / 本书的组织结构 22
Conventions Used in This Book / 本书的约定 22
Typeface / 字体 22
Program Output / 程序输出 23
Special Elements / 特殊元素 24
Summary / 本章小结 24
Review Questions / 复习题 25
Programming Exercise / 编程练习 25
2 Introducing C 27
第2章 C语言概述
A Simple Example of C / 简单的C程序示例 27
The Example Explained / 示例解释 28
Pass 1: Quick Synopsis / 第1遍:快速概要 30
Pass 2: Program Details / 第2遍:程序细节 31
The Structure of a Simple Program / 简单程序的结构 40
Tips on Making Your Programs Readable / 提高程序可读性的技巧 41
Taking Another Step in Using C / 进一步使用C 42
Documentation / 程序说明 43
Multiple Declarations / 多条声明 43
Multiplication / 乘法 43
Printing Multiple Values / 打印多个值 43
While You’re at It—Multiple Functions / 多个函数 44
Introducing Debugging / 调试程序 46
Syntax Errors / 语法错误 46
Semantic Errors / 语义错误 47
Program State / 程序状态 49
Keywords and Reserved Identifiers / 关键字和保留标识符 49
Key Concepts / 关键概念 50
Summary / 本章小结 51
Review Questions / 复习题 51
Programming Exercises / 编程练习 53
3 Data and C 55
第3章 数据和C
A Sample Program / 示例程序 55
What’s New in This Program? / 程序中的新元素 57
Data Variables and Constants / 变量与常量数据 59
Data: Data-Type Keywords / 数据:数据类型关键字 59
Integer Versus Floating-Point Types / 整数和浮点数 60
The Integer / 整数 61
The Floating-Point Number / 浮点数 61
Basic C Data Types / C语言基本数据类型 62
The int Type / int类型 62
Other Integer Types / 其他整数类型 66
Using Characters: Type char / 使用字符:char类型 71
The _Bool Type / _Bool类型 77
Portable Types: stdint.h and inttypes.h / 可移植类型:stdint.h和inttypes.h 77
Types float, double, and long double / float、double和long double 79
Complex and Imaginary Types / 复数和虚数类型 85
Beyond the Basic Types / 其他类型 85
Type Sizes / 类型大小 87
Using Data Types / 使用数据类型 88
Arguments and Pitfalls / 参数和陷阱 89
One More Example: Escape Sequences / 转义序列示例 91
What Happens When the Program Runs / 程序运行情况 91
Flushing the Output / 刷新输出 92
Key Concepts / 关键概念 93
Summary / 本章小结 93
Review Questions / 复习题 94
Programming Exercises / 编程练习 97
4 Character Strings and Formatted Input/Output 99
第4章 字符串和格式化输入/输出
Introductory Program / 前导程序 99
Character Strings: An Introduction / 字符串简介 101
Type char Arrays and the Null Character / char类型数组和null字符 101
Using Strings / 使用字符串 102
The strlen() Function / strlen()函数 103
Constants and the C Preprocessor / 常量和C预处理器 106
The const Modifier / const限定符 109
Manifest Constants on the Job / 明示常量 109
Exploring and Exploiting printf() and scanf() / printf()和scanf() 112
The printf() Function / printf()函数 112
Using printf() / 使用printf() 113
Conversion Specification Modifiers for printf() / printf()的转换说明修饰符 115
What Does a Conversion Specification Convert? / 转换说明的意义 122
Using scanf() / 使用scanf() 128
The * Modifier with printf() and scanf() / printf()和scanf()的*修饰符 133
Usage Tips for printf() / printf()的用法提示 135
Key Concepts / 关键概念 136
Summary / 本章小结 137
Review Questions / 复习题 138
Programming Exercises / 编程练习 140
5 Operators, Expressions, and Statements 143
第5章 运算符、表达式和语句
Introducing Loops / 循环简介 144
Fundamental Operators / 基本运算符 146
Assignment Operator: = / 赋值运算符:= 146
Addition Operator: + / 加法运算符:+ 149
Subtraction Operator: - / 减法运算符:- 149
Sign Operators: - and + / 符号运算符:-和+ 150
Multiplication Operator: * / 乘法运算符:* 151
Division Operator: / / 除法运算符:/ 153
Operator Precedence / 运算符优先级 154
Precedence and the Order of Evaluation / 优先级和求值顺序 156
Some Additional Operators / 其他运算符 157
The sizeof Operator and the size_t Type / sizeof运算符和size_t类型 158
Modulus Operator: % / 求模运算符:% 159
Increment and Decrement Operators: ++ and -- / 递增和递减运算符:++和-- 160
Decrementing: -- / 递减运算符:-- 164
Precedence / 优先级 165
Don’t Be Too Clever / 不要自作聪明 166
Expressions and Statements / 表达式和语句 167
Expressions / 表达式 167
Statements / 语句 168
Compound Statements (Blocks) / 复合语句(块) 171
Type Conversions / 类型转换 174
The Cast Operator / 强制类型转换运算符 176
Function with Arguments / 带参数的函数 177
A Sample Program / 示例程序 180
Key Concepts / 关键概念 182
Summary / 本章小结 182
Review Questions / 复习题 183
Programming Exercises / 编程练习 187
6 C Control Statements: Looping 189
第6章 C控制语句:循环
Revisiting the while Loop / 再探while循环 190
Program Comments / 程序注释 191
C-Style Reading Loop / C风格读取循环 192
The while Statement / while语句 193
Terminating a while Loop / 终止while循环 194
When a Loop Terminates / 何时终止循环 194
while: An Entry-Condition Loop / while:入口条件循环 195
Syntax Points / 语法要点 195
Which Is Bigger: Using Relational Operators and Expressions / 用关系运算符和表达式比较大小 197
What Is Truth? / 什么是真 199
What Else Is True? / 其他真值 200
Troubles with Truth / 真值的问题 201
The New _Bool Type / 新的_Bool类型 203
Precedence of Relational Operators / 优先级和关系运算符 205
Indefinite Loops and Counting Loops / 不确定循环和计数循环 207
The for Loop / for循环 208
Using for for Flexibility / 利用for的灵活性 210
More Assignment Operators: +=, -=, *=, /=, %= / 其他赋值运算符:+=、-=、*=、/=、%= 215
The Comma Operator / 逗号运算符 215
Zeno Meets the for Loop / 当Zeno遇到for循环 218
An Exit-Condition Loop: do while / 出口条件循环:do while 220
Which Loop? / 如何选择循环 223
Nested Loops / 嵌套循环 224
Program Discussion / 程序分析 225
A Nested Variation / 嵌套变式 225
Introducing Arrays / 数组简介 226
Using a for Loop with an Array / 在for循环中使用数组 228
A Loop Example Using a Function Return Value / 使用函数返回值的循环示例 230
Program Discussion / 程序分析 232
Using Functions with Return Values / 使用带返回值的函数 233
Key Concepts / 关键概念 234
Summary / 本章小结 235
Review Questions / 复习题 236
Programming Exercises / 编程练习 241
7 C Control Statements: Branching and Jumps 245
第7章 C控制语句:分支和跳转
The if Statement / if语句 246
Adding else to the if Statement / if else语句 248
Another Example: Introducing getchar() and putchar() / 另一个示例:介绍getchar()和putchar() 250
The ctype.h Family of Character Functions / ctype.h系列的字符函数 252
Multiple Choice else if / 多重选择else if 254
Pairing else with if / else与if配对 257
More Nested ifs / 多层嵌套的if语句 259
Let’s Get Logical / 逻辑运算符 263
Alternate Spellings: The iso646.h Header File / 备选拼写:iso646.h头文件 265
Precedence / 优先级 265
Order of Evaluation / 求值顺序 266
Ranges / 范围 267
A Word-Count Program / 一个统计单词的程序 268
The Conditional Operator: ?: / 条件运算符:?: 271
Loop Aids: continue and break / 循环辅助:continue和break 274
The continue Statement / continue语句 274
The break Statement / break语句 277
Multiple Choice: switch and break / 多重选择:switch和break 280
Using the switch Statement / switch语句 281
Reading Only the First Character of a Line / 只读每行的首字符 283
Multiple Labels / 多重标签 284
switch and if else / switch和if else 286
The goto Statement / goto语句 287
Avoiding goto / 避免使用goto 287
Key Concepts / 关键概念 291
Summary / 本章小结 291
Review Questions / 复习题 292
Programming Exercises / 编程练习 296
8 Character Input/Output and Input Validation 299
第8章 字符输入/输出和输入验证
Single-Character I/O: getchar() and putchar()
/ 单字符I/O:getchar()和putchar() 300
Buffers / 缓冲区 301
Terminating Keyboard Input / 结束键盘输入 302
Files, Streams, and Keyboard Input / 文件、流和键盘输入 303
The End of File / 文件结尾 304
Redirection and Files / 重定向和文件 307
Unix, Linux, and Windows Command Prompt Redirection / Unix、Linux和DOS重定向 307
Creating a Friendlier User Interface / 创建更友好的用户界面 312
Working with Buffered Input / 使用缓冲输入 312
Mixing Numeric and Character Input / 混合数值和字符输入 314
Input Validation / 输入验证 317
Analyzing the Program / 分析程序 322
The Input Stream and Numbers / 输入流和数字 323
Menu Browsing / 菜单浏览 324
Tasks / 任务 324
Toward a Smoother Execution / 使执行更顺利 325
Mixing Character and Numeric Input / 混合字符和数值输入 327
Key Concepts / 关键概念 330
Summary / 本章小结 331
Review Questions / 复习题 331
Programming Exercises / 编程练习 332
9 Functions 335
第9章 函数
Reviewing Functions / 复习函数 335
Creating and Using a Simple Function / 创建并使用简单函数 337
Analyzing the Program / 分析程序 338
Function Arguments / 函数参数 340
Defining a Function with an Argument: Formal Parameters / 定义带形式参数的函数 342
Prototyping a Function with Arguments / 声明带形式参数函数的原型 343
Calling a Function with an Argument: Actual Arguments / 调用带实际参数的函数 343
The Black-Box Viewpoint / 黑盒视角 345
Returning a Value from a Function with return / 使用return从函数中返回值 345
Function Types / 函数类型 348
ANSI C Function Prototyping / ANSI C函数原型 349
The Problem / 问题所在 350
The ANSI C Solution / ANSI的解决方案 351
No Arguments and Unspecified Arguments / 无参数和未指定参数 352
Hooray for Prototypes / 函数原型的优点 353
Recursion / 递归 353
Recursion Revealed / 演示递归 354
Recursion Fundamentals / 递归的基本原理 355
Tail Recursion / 尾递归 356
Recursion and Reversal / 递归和倒序计算 358
Recursion Pros and Cons / 递归的优缺点 360
Compiling Programs with Two or More Source Code Files
/ 编译多源代码文件的程序 361
Unix / Unix 362
Linux / Linux 362
DOS Command-Line Compilers / DOS命令行编译器 362
Windows and Apple IDE Compilers / Windows和苹果的IDE编译器 362
Using Header Files / 使用头文件 363
Finding Addresses: The & Operator / 查找地址:&运算符 367
Altering Variables in the Calling Function / 更改主调函数中的变量 369
Pointers: A First Look / 指针简介 371
The Indirection Operator: * / 间接运算符:* 371
Declaring Pointers / 声明指针 372
Using Pointers to Communicate Between Functions / 使用指针在函数间通信 373
Key Concepts / 关键概念 378
Summary / 本章小结 378
Review Questions / 复习题 379
Programming Exercises / 编程练习 380
10 Arrays and Pointers 383
第10章 数组和指针
Arrays / 数组 383
Initialization / 初始化数组 384
Designated Initializers (C99) / 指定初始化器(C99) 388
Assigning Array Values / 给数组元素赋值 390
Array Bounds / 数组边界 390
Specifying an Array Size / 指定数组的大小 392
Multidimensional Arrays / 多维数组 393
Initializing a Two-Dimensional Array / 初始化二维数组 397
More Dimensions / 其他多维数组 398
Pointers and Arrays / 指针和数组 398
Functions, Arrays, and Pointers / 函数、数组和指针 401
Using Pointer Parameters / 使用指针形参 404
Comment: Pointers and Arrays / 指针表示法和数组表示法 407
Pointer Operations / 指针操作 407
Protecting Array Contents / 保护数组中的数据 412
Using const with Formal Parameters / 对形式参数使用const 413
More About const / const的其他内容 415
Pointers and Multidimensional Arrays / 指针和多维数组 417
Pointers to Multidimensional Arrays / 指向多维数组的指针 420
Pointer Compatibility / 指针的兼容性 421
Functions and Multidimensional Arrays / 函数和多维数组 423
Variable-Length Arrays (VLAs) / 变长数组(VLA) 427
Compound Literals / 复合字面量 431
Key Concepts / 关键概念 434
Summary / 本章小结 435
Review Questions / 复习题 436
Programming Exercises / 编程练习 439
11 Character Strings and String Functions 441
第11章 字符串和字符串函数
Representing Strings and String I/O / 表示字符串和字符串I/O 441
Defining Strings Within a Program / 在程序中定义字符串 442
Pointers and Strings / 指针和字符串 451
String Input / 字符串输入 453
Creating Space / 分配空间 453
The Unfortunate gets() Function / 不幸的gets()函数 453
The Alternatives to gets() / gets()的替代品 455
The scanf() Function / scanf()函数 462
String Output / 字符串输出 464
The puts() Function / puts()函数 464
The fputs() Function / fputs()函数 465
The printf() Function / printf()函数 466
The Do-It-Yourself Option / 自定义输入/输出函数 466
String Functions / 字符串函数 469
The strlen() Function / strlen()函数 469
The strcat() Function / strcat()函数 471
The strncat() Function / strncat()函数 473
The strcmp() Function / strcmp()函数 475
The strcpy() and strncpy() Functions / strcpy()和strncpy()函数 482
The sprintf() Function / sprintf()函数 487
Other String Functions / 其他字符串函数 489
A String Example: Sorting Strings / 字符串示例:字符串排序 491
Sorting Pointers Instead of Strings / 排序指针而非字符串 493
The Selection Sort Algorithm / 选择排序算法 494
The ctype.h Character Functions and Strings / ctype.h字符函数和字符串 495
Command-Line Arguments / 命令行参数 497
Command-Line Arguments in Integrated Environments / 集成环境中的命令行参数 500
Command-Line Arguments with the Macintosh / Macintosh中的命令行参数 500
String-to-Number Conversions / 把字符串转换为数字 500
Key Concepts / 关键概念 504
Summary / 本章小结 504
Review Questions / 复习题 505
Programming Exercises / 编程练习 508
12 Storage Classes, Linkage, and Memory Management 511
第12章 存储类别、链接和内存管理
Storage Classes / 存储类别 511
Scope / 作用域 513
Linkage / 链接 515
Storage Duration / 存储期 516
Automatic Variables / 自动变量 518
Register Variables / 寄存器变量 522
Static Variables with Block Scope / 块作用域的静态变量 522
Static Variables with External Linkage / 外部链接的静态变量 524
Static Variables with Internal Linkage / 内部链接的静态变量 529
Multiple Files / 多文件 530
Storage-Class Specifier Roundup / 存储类别说明符 530
Storage Classes and Functions / 存储类别和函数 533
Which Storage Class? / 存储类别的选择 534
A Random-Number Function and a Static Variable / 随机数函数和静态变量 534
Roll’Em / 掷骰子 538
Allocated Memory: malloc() and free() / 分配内存:malloc()和free() 543
The Importance of free() / free()的重要性 547
The calloc() Function / calloc()函数 548
Dynamic Memory Allocation and Variable-Length Arrays / 动态内存分配和变长数组 548
Storage Classes and Dynamic Memory Allocation / 存储类别和动态内存分配 549
ANSI C Type Qualifiers / ANSI C类型限定符 551
The const Type Qualifier / const类型限定符 552
The volatile Type Qualifier / volatile类型限定符 554
The restrict Type Qualifier / restrict类型限定符 555
The _Atomic Type Qualifier (C11) / _Atomic类型限定符(C11) 556
New Places for Old Keywords / 旧关键字的新位置 557
Key Concepts / 关键概念 558
Summary / 本章小结 558
Review Questions / 复习题 559
Programming Exercises / 编程练习 561
13 File Input/Output 565
第13章 文件输入/输出
Communicating with Files / 与文件进行通信 565
What Is a File? / 文件是什么 566
The Text Mode and the Binary Mode / 文本模式和二进制模式 566
Levels of I/O / I/O的级别 568
Standard Files / 标准文件 568
Standard I/O / 标准I/O 568
Checking for Command-Line Arguments / 检查命令行参数 569
The fopen() Function / fopen()函数 570
The getc() and putc() Functions / getc()和putc()函数 572
End-of-File / 文件结尾 572
The fclose() Function / fclose()函数 574
Pointers to the Standard Files / 指向标准文件的指针 574
A Simple-Minded File-Condensing Program / 一个简单的文件压缩程序 574
File I/O: fprintf(), fscanf(), fgets(), and fputs()
/ 文件I/O:fprintf()、fscanf()、fgets()和fputs() 576
The fprintf() and fscanf() Functions / fprintf()和fscanf()函数 576
The fgets() and fputs() Functions / fgets()和fputs()函数 578
Adventures in Random Access: fseek() and ftell()
/ 随机访问:fseek()和ftell() 579
How fseek() and ftell() Work / fseek()和ftell()的工作原理 580
Binary Versus Text Mode / 二进制模式和文本模式 582
Portability / 可移植性 582
The fgetpos() and fsetpos() Functions / fgetpos()和fsetpos()函数 583
Behind the Scenes with Standard I/O / 标准I/O的机理 583
Other Standard I/O Functions / 其他标准I/O函数 584
The int ungetc(int c, FILE *fp) Function / int ungetc(int c, FILE *fp)函数 585
The int fflush() Function / int fflush()函数 585
The int setvbuf() Function / int setvbuf()函数 585
Binary I/O: fread() and fwrite() / 二进制I/O:fread()和fwrite() 586
The size_t fwrite() Function / size_t fwrite()函数 588
The size_t fread() Function / size_t fread()函数 588
The int feof(FILE *fp) and int ferror(FILE *fp) Functions
/ int feof(FILE *fp)和int ferror(FILE *fp)函数 589
An fread() and fwrite() Example / 一个程序示例 589
Random Access with Binary I/O / 用二进制I/O进行随机访问 593
Key Concepts / 关键概念 594
Summary / 本章小结 595
Review Questions / 复习题 596
Programming Exercises / 编程练习 598
14 Structures and Other Data Forms 601
第14章 结构和其他数据形式
Sample Problem: Creating an Inventory of Books / 示例问题:创建图书目录 601
Setting Up the Structure Declaration / 建立结构声明 604
Defining a Structure Variable / 定义结构变量 604
Initializing a Structure / 初始化结构 606
Gaining Access to Structure Members / 访问结构成员 607
Initializers for Structures / 结构的初始化器 607
Arrays of Structures / 结构数组 608
Declaring an Array of Structures / 声明结构数组 611
Identifying Members of an Array of Structures / 标识结构数组的成员 612
Program Discussion / 程序讨论 612
Nested Structures / 嵌套结构 613
Pointers to Structures / 指向结构的指针 615
Declaring and Initializing a Structure Pointer / 声明和初始化结构指针 617
Member Access by Pointer / 用指针访问成员 617
Telling Functions About Structures / 向函数传递结构的信息 618
Passing Structure Members / 传递结构成员 618
Using the Structure Address / 传递结构的地址 619
Passing a Structure as an Argument / 传递结构 621
More on Structure Features / 其他结构特性 622
Structures or Pointer to Structures? / 结构和结构指针的选择 626
Character Arrays or Character Pointers in a Structure
/ 结构中的字符数组和字符指针 627
Structure, Pointers, and malloc() / 结构、指针和malloc() 628
Compound Literals and Structures (C99) / 复合字面量和结构(C99) 631
Flexible Array Members (C99) / 伸缩型数组成员(C99) 633
Anonymous Structures (C11) / 匿名结构(C11) 636
Functions Using an Array of Structures / 使用结构数组的函数 637
Saving the Structure Contents in a File / 把结构内容保存到文件中 639
A Structure-Saving Example / 保存结构的程序示例 640
Program Points / 程序要点 643
Structures: What Next? / 链式结构 644
Unions: A Quick Look / 联合简介 645
Using Unions / 使用联合 646
Anonymous Unions (C11) / 匿名联合(C11) 647
Enumerated Types / 枚举类型 649
enum Constants / enum常量 649
Default Values / 默认值 650
Assigned Values / 赋值 650
enum Usage / enum的用法 650
Shared Namespaces / 共享名称空间 652
typedef: A Quick Look / typedef简介 653
Fancy Declarations / 其他复杂的声明 655
Functions and Pointers / 函数和指针 657
Key Concepts / 关键概念 665
Summary / 本章小结 665
Review Questions / 复习题 666
Programming Exercises / 编程练习 669
15 Bit Fiddling 673
第15章 位操作
Binary Numbers, Bits, and Bytes / 二进制数、位和字节 674
Binary Integers / 二进制整数 674
Signed Integers / 有符号整数 675
Binary Floating Point / 二进制浮点数 676
Other Number Bases / 其他进制数 676
Octal / 八进制 677
Hexadecimal / 十六进制 677
C’s Bitwise Operators / C按位运算符 678
Bitwise Logical Operators / 按位逻辑运算符 678
Usage: Masks / 用法:掩码 680
Usage: Turning Bits On (Setting Bits) / 用法:打开位(设置位) 681
Usage: Turning Bits Off (Clearing Bits) / 用法:关闭位(清空位) 682
Usage: Toggling Bits / 用法:切换位 683
Usage: Checking the Value of a Bit / 用法:检查位的值 683
Bitwise Shift Operators / 移位运算符 684
Programming Example / 编程示例 685
Another Example / 另一个例子 688
Bit Fields / 位字段 690
Bit-Field Example / 位字段示例 692
Bit Fields and Bitwise Operators / 位字段和按位运算符 696
Alignment Features (C11) / 对齐特性(C11) 703
Key Concepts / 关键概念 705
Summary / 本章小结 706
Review Questions / 复习题 706
Programming Exercises / 编程练习 708
16 The C Preprocessor and the C Library 711
第16章 C预处理器和C库
First Steps in Translating a Program / 翻译程序的第一步 712
Manifest Constants: #define / 明示常量:#define 713
Tokens / 记号 717
Redefining Constants / 重定义常量 717
Using Arguments with #define / 在#define中使用参数 718
Creating Strings from Macro Arguments: The # Operator
/ 用宏参数创建字符串:#运算符 721
Preprocessor Glue: The ## Operator / 预处理器粘合剂:##运算符 722
Variadic Macros: ... and _ _VA_ARGS_ _ / 变参宏:...和_ _VA_ARGS_ _ 723
Macro or Function? / 宏和函数的选择 725
File Inclusion: #include / 文件包含:#include 726
Header Files: An Example / 头文件示例 727
Uses for Header Files / 使用头文件 729
Other Directives / 其他指令 730
The #undef Directive / #undef指令 731
Being Defined—The C Preprocessor Perspective / 从C预处理器角度看已定义 731
Conditional Compilation / 条件编译 731
Predefined Macros / 预定义宏 737
#line and #error / #line和#error 738
#pragma / #pragma 739
Generic Selection (C11) / 泛型选择(C11) 740
Inline Functions (C99) / 内联函数(C99) 741
_Noreturn Functions (C11) / _Noreturn函数(C11) 744
The C Library / C库 744
Gaining Access to the C Library / 访问C库 745
Using the Library Descriptions / 使用库描述 746
The Math Library / 数学库 747
A Little Trigonometry / 三角问题 748
Type Variants / 类型变体 750
The tgmath.h Library (C99) / tgmath.h库(C99) 752
The General Utilities Library / 通用工具库 753
The exit() and atexit() Functions / exit()和atexit()函数 753
The qsort() Function / qsort()函数 755
The Assert Library / 断言库 760
Using assert / assert的用法 760
_Static_assert (C11) / _Static_assert(C11) 762
memcpy() and memmove() from the string.h Library
/ string.h库中的memcpy()和memmove() 763
Variable Arguments: stdarg.h / 可变参数:stdarg.h 765
Key Concepts / 关键概念 768
Summary / 本章小结 768
Review Questions / 复习题 768
Programming Exercises / 编程练习 770
17 Advanced Data Representation 773
第17章 高级数据表示
Exploring Data Representation / 研究数据表示 774
Beyond the Array to the Linked List / 从数组到链表 777
Using a Linked List / 使用链表 781
Afterthoughts / 反思 786
Abstract Data Types (ADTs) / 抽象数据类型(ADT) 786
Getting Abstract / 建立抽象 788
Building an Interface / 建立接口 789
Using the Interface / 使用接口 793
Implementing the Interface / 实现接口 796
Getting Queued with an ADT / 队列ADT 804
Defining the Queue Abstract Data Type / 定义队列抽象数据类型 804
Defining an Interface / 定义一个接口 805
Implementing the Interface Data Representation / 实现接口数据表示 806
Testing the Queue / 测试队列 815
Simulating with a Queue / 用队列进行模拟 818
The Linked List Versus the Array / 链表和数组 824
Binary Search Trees / 二叉查找树 828
A Binary Tree ADT / 二叉树ADT 829
The Binary Search Tree Interface / 二叉查找树接口 830
The Binary Tree Implementation / 二叉树的实现 833
Trying the Tree / 使用二叉树 849
Tree Thoughts / 树的思想 854
Other Directions / 其他说明 856
Key Concepts / 关键概念 856
Summary / 本章小结 857
Review Questions / 复习题 857
Programming Exercises / 编程练习 858
A Answers to the Review Questions 861
附录A 复习题答案
Answers to Review Questions for Chapter 1 / 第1章复习题答案 861
Answers to Review Questions for Chapter 2 / 第2章复习题答案 862
Answers to Review Questions for Chapter 3 / 第3章复习题答案 863
Answers to Review Questions for Chapter 4 / 第4章复习题答案 866
Answers to Review Questions for Chapter 5 / 第5章复习题答案 869
Answers to Review Questions for Chapter 6 / 第6章复习题答案 872
Answers to Review Questions for Chapter 7 / 第7章复习题答案 876
Answers to Review Questions for Chapter 8 / 第8章复习题答案 879
Answers to Review Questions for Chapter 9 / 第9章复习题答案 881
Answers to Review Questions for Chapter 10 / 第10章复习题答案 883
Answers to Review Questions for Chapter 11 / 第11章复习题答案 886
Answers to Review Questions for Chapter 12 / 第12章复习题答案 890
Answers to Review Questions for Chapter 13 / 第13章复习题答案 891
Answers to Review Questions for Chapter 14 / 第14章复习题答案 894
Answers to Review Questions for Chapter 15 / 第15章复习题答案 898
Answers to Review Questions for Chapter 16 / 第16章复习题答案 899
Answers to Review Questions for Chapter 17 / 第17章复习题答案 901
B Reference Section 905
附录B 参考资料
Section Ⅰ: Additional Reading / 参考资料Ⅰ:补充阅读 905
Online Resources / 在线资源 905
C Language Books / C语言书籍 907
Programming Books / 编程书籍 907
Reference Books / 参考书籍 908
C++ Books / C++书籍 908
Section Ⅱ: C Operators / 参考资料Ⅱ:C运算符 908
Arithmetic Operators / 算术运算符 909
Relational Operators / 关系运算符 910
Assignment Operators / 赋值运算符 910
Logical Operators / 逻辑运算符 911
The Conditional Operator / 条件运算符 911
Pointer-Related Operators / 与指针有关的运算符 912
Sign Operators / 符号运算符 912
Structure and Union Operators / 结构和联合运算符 912
Bitwise Operators / 按位运算符 913
Miscellaneous Operators / 混合运算符 914
Section Ⅲ: Basic Types and Storage Classes
/ 参考资料Ⅲ:基本类型和存储类别 915
Summary: The Basic Data Types / 总结:基本数据类型 915
Summary: How to Declare a Simple Variable / 总结:如何声明一个简单变量 917
Summary: Qualifiers / 总结:限定符 919
Section Ⅳ: Expressions, Statements, and Program Flow
/ 参考资料Ⅳ:表达式、语句和程序流 920
Summary: Expressions and Statements / 总结:表达式和语句 920
Summary: The while Statement / 总结:while语句 921
Summary: The for Statement / 总结:for语句 921
Summary: The do while Statement / 总结:do while语句 922
Summary: Using if Statements for Making Choices / 总结:if语句 923
Summary: Multiple Choice with switch / 带多重选择的switch语句 924
Summary: Program Jumps / 总结:程序跳转 925
Section Ⅴ: The Standard ANSI C Library with C99 and C11 Additions
/ 参考资料Ⅴ:新增C99和C11的ANSI C库 926
Diagnostics: assert.h / 断言:assert.h 926
Complex Numbers: complex.h (C99) / 复数:complex.h(C99) 927
Character Handling: ctype.h / 字符处理:ctype.h 929
Error Reporting: errno.h / 错误报告:errno.h 930
Floating-Point Environment: fenv.h (C99) / 浮点环境:fenv.h(C99) 930
Floating-point Characteristics: float.h / 浮点特性:float.h 933
Format Conversion of Integer Types: inttypes.h (C99) / 整数类型的格式转换:inttypes.h 935
Alternative Spellings: iso646.h / 可选拼写:iso646.h 936
Localization: locale.h / 本地化:locale.h 936
Math Library: math.h / 数学库:math.h 939
Non-Local Jumps: setjmp.h / 非本地跳转:setjmp.h 945
Signal Handling: signal.h / 信号处理:signal.h 945
Alignment: stdalign.h (C11) / 对齐:stdalign.h(C11) 946
Variable Arguments: stdarg.h / 可变参数:stdarg.h 947
Atomics Support: stdatomic.h (C11) / 原子支持:stdatomic.h(C11) 948
Boolean Support: stdbool.h (C99) / 布尔支持:stdbool.h(C99) 948
Common Definitions: stddef.h / 通用定义:stddef.h 948
Integer Types: stdint.h / 整数类型:stdint.h 949
Standard I/O Library: stdio.h / 标准I/O库:stdio.h 953
General Utilities: stdlib.h / 通用工具:stdlib.h 956
_Noreturn: stdnoreturn.h / _Noreturn:stdnoreturn.h 962
String Handling: string.h / 处理字符串:string.h 962
Type-Generic Math: tgmath.h (C99) / 通用类型数学:tgmath.h(C99) 965
Threads: threads.h (C11) / 线程:threads.h(C11) 967
Date and Time: time.h / 日期和时间:time.h 967
Unicode Utilities: uchar.h (C11) / 统一码工具:uchar.h(C11) 971
Extended Multibyte and Wide-Character Utilities: wchar.h (C99)
/ 扩展的多字节字符和宽字符工具:wchar.h(C99) 972
Wide Character Classification and Mapping Utilities: wctype.h (C99)
/ 宽字符分类和映射工具:wctype.h(C99) 978
Section Ⅵ: Extended Integer Types / 参考资料Ⅵ:扩展的整数类型 980
Exact-Width Types / 精确宽度类型 981
Minimum-Width Types / 最小宽度类型 982
Fastest Minimum-Width Types / 最快最小宽度类型 983
Maximum-Width Types / 最大宽度类型 983
Integers That Can Hold Pointer Values / 可储存指针值的整型 984
Extended Integer Constants / 扩展的整型常量 984
Section Ⅶ: Expanded Character Support / 参考资料Ⅶ:扩展字符支持 984
Trigraph Sequences / 三字符序列 984
Digraphs / 双字符 985
Alternative Spellings: iso646.h / 可选拼写:iso646.h 986
Multibyte Characters / 多字节字符 986
Universal Character Names (UCNs) / 通用字符名(UCN) 987
Wide Characters / 宽字符 988
Wide Characters and Multibyte Characters / 宽字符和多字节字符 989
Section Ⅷ: C99/C11 Numeric Computational Enhancements
/ 参考资料Ⅷ:C99/C11数值计算增强 990
The IEC Floating-Point Standard / IEC浮点标准 990
The fenv.h Header File / fenv.h头文件 994
The STDC FP_CONTRACT Pragma / STDC FP_CONTRACT编译指示 995
Additions to the math.h Library / math.h库增补 995
Support for Complex Numbers / 对复数的支持 996
Section Ⅸ: Differences Between C and C++ / 参考资料Ⅸ:C和C++的区别 998
Function Prototypes / 函数原型 999
char Constants / char常量 1000
The const Modifier / const限定符 1000
Structures and Unions / 结构和联合 1001
Enumerations / 枚举 1002
Pointer-to-void / 指向void的指针 1002
Boolean Types / 布尔类型 1003
Alternative Spellings / 可选拼写 1003
Wide-Character Support / 宽字符支持 1003
Complex Types / 复数类型 1003
Inline Functions / 内联函数 1003
C99/11 Features Not Found in C++11 / C++11中没有的C99/C11特性 1004