Share E-Book
Scan to open this page

Scan with your phone to open this page

Author[美] K. N. 金

第 2 版前言 在计算领域中,把显而易见的转变为有实用价值的,这一过程是“挫折”一词的 生动体现。 自本书第 1 版出版以来,基于 C 的语言大量兴起(其中最杰出的是 Java 和 C#),C++和 Perl 等相关语言也取得了更大的成就。尽管如此,C 语言仍然像当年一样流行,悄无声息地掌控着 世界上的许多软件。跟 1996 年一样,C 语言仍然是计算机领域里的通用语言。 然而,即便是 C 语言也必须随着时间而发展。C99 标准的发布催生了对本书第 2 版的需求, 而且,第 1 版涉及的 DOS 和 16 位处理器也趋于过时。同样,C11 和 C18 的发布促使修订版对 内容进行了全面更新,并在其他许多方面做了改进。 修订版新增内容 下面列出了这一版的新特色和所做的改进。  完整覆盖了 C89、C99 和 C1X 标准。这一版和第 1 版的最大差别就在于覆盖了 C99 和 C1X 标准。我的目标是覆盖 C89、C99 和 C1X 之间的每一个重要差别,包括新标准新增 的所有语言特性和库函数。新标准中的每一处改变都会清楚地用 C99 或者 C1X 标出来, 或者在节标题上,或者进行简短讨论时在正文左边空白处。这样做有两个目的:一是提 醒读者注意新标准中的改变,二是让那些对新标准不感兴趣或没有新标准编译器的读者 知道哪些内容可以跳过。新标准新增的许多内容可能只有特定的读者会感兴趣,但有些 新特性几乎对所有的 C 程序员都有用。这一版中有关 C1X 的内容(包括整个第 28 章) 是由李忠负责完成的,他修正了原书中过时的内容和不准确的表述,调整了部分术语的 中文译法,并更正了上一版中的翻译问题。  提供了对所有 C89、C99 和 C1X 库函数的快速参考。第 1 版附录 E 介绍了 C89 的所有 标准库函数,这一版附录 E 给出了 C89、C99 和 C1X 的所有库函数。  扩展了 GCC 的内容。自本书第 1 版出版以来,GCC(最初是 GNU C Compiler 的简称, 现在指 GNU Compiler Collection)得到了广泛应用。GCC 有很多优点,包括高性能、低 成本(不用花钱)以及在众多软硬件平台之间的可移植性等。由于认识到 GCC 日渐重 要,我在这一版中介绍了更多与 GCC 相关的信息,包括如何使用 GCC 以及常见的 GCC 出错消息和警告。截至目前,GCC 尚未在它的 C 标准库实现中添加多线程支持,在学 习本书第 28 章时,建议使用 Pelles C。尽管不那么有名,但它是当前对标准支持最好的 C 语言开发工具。  增加了对抽象数据类型的讨论。在第 1 版中,第 19 章重点讨论了 C++。这部分内容现 在看起来似乎作用不大,因为本书的读者可能已经学过 C++、Java 或者 C#了。在这一 版中,我将对 C++的介绍替换为讨论如何在 C 中建立抽象数据类型。  扩展了国际化特性的内容。这一版第 25 章更加详尽地讨论了 C 语言的国际化特性,重 点扩展了 Unicode 字符集及编码。 针对 CPU 和操作系统做了更新。当我编写本书第 1 版时,许多读者用的还是 16 位机和 DOS 操作系统,但现在情况不同了。在这一版中,我把讨论的重点放在 32 位机和 64 位 机上。鉴于 Linux 和其他版本 UNIX 的兴起,我们会对该类操作系统给予更多关注。不 过,在可能影响到 C 程序员的场合,我们也会提到 Windows 和 macOS 操作系统的相关 方面。  引入了多线程的内容。从 C11 开始,新标准的最大变化是引入了多线程和原子操作。这 部分内容较多,而且是非常新颖的内容,值得大书特书,并作为一个整体系统性地加以 介绍,为此我们把它放在第 28 章。市面上和 C 语言有关的图书多如牛毛,但据我们所 知,介绍多线程和原子操作的图书,这还是第一本。  更多的练习题和编程题。本书第 1版包括 311道习题,这一版有 500多(准确地说是 502) 道习题,分为两组:练习题与编程题。  练习题和编程题的答案。本书第 1 版的读者反馈最多的问题就是希望我提供习题的答案。 针对读者的这一需求,我将大约三分之一的练习题和编程题的答案放到了网上,见 https://exl.ptpress.cn:8442/ex/l/609033ea。这一特色对于那些没有选修相应大学课程却需 要检验自己工作的读者来说是非常有用的。提供了答案的练习题和编程题①都用 图标做 了标记。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A comprehensive, modern textbook on C programming that covers everything from C89 to C18 standards, ideal for university students, self-learners, and professionals who want a deep, standards-aware understanding of C rather than a quick reference. 【Book Arc】 - **Opening (~0%–9%)**: The preface and introduction establish the book's "modern method" philosophy—covering C89, C99, C11, and C18 standards, emphasizing software engineering over manual optimization, and debunking outdated myths about C. It positions the book as a complete, up-to-date alternative to K&R. - **Early (~9%–27%)**: The book lays out its pedagogical approach: a spiral teaching method that introduces difficult topics (like pointers) early but defers full detail to later chapters, with "Q&A" sections at each chapter's end for deeper or non-essential material. The structure is explicitly designed to avoid information overload. - **Early (~27%–32%)**: The organizational map is presented: four parts covering basic features (Ch. 1–10), advanced features (Ch. 11–20), the standard library (Ch. 21–28), and reference appendices. Guidance is given on what can be skipped in short courses, and the book's target audience (undergraduates, self-learners) is clarified. - **Middle (~41%–55%)**: The table of contents reveals the progression through core language topics: starting with basic concepts (variables, types, I/O), moving to control flow (selection statements, loops), then fundamental types (integers, floats, characters, type conversion), arrays, functions, and program structure—each chapter ending with exercises and programming problems. - **Middle (~55%+)**: The book transitions into its advanced core: pointers (Ch. 11) and pointer-array relationships (Ch. 12), which are treated as the gateway to understanding C's power and complexity, with dedicated chapters on pointer arithmetic, multidimensional arrays, and C99 variable-length arrays. 【Key Takeaways】 - **Standards coverage is the book's defining feature** (Opening): It systematically covers C89, C99, and C11/C18, marking every new-standard change clearly so readers can skip what they don't need. This makes it the most current comprehensive C textbook available. - **The "spiral method" makes hard topics accessible** (Early): Difficult concepts like pointers are introduced early (Ch. 3) but fully explained later (Ch. 11, 18), preventing beginners from being overwhelmed while keeping advanced readers engaged. - **"Q&A" sections are a hidden gem** (Early): Each chapter ends with questions that clarify common pitfalls, discuss compiler differences, and cover advanced topics (marked with asterisks). These are invaluable for self-learners and experienced programmers alike. - **Software engineering is prioritized over "clever" code** (Early): The book emphasizes readability, maintainability, and portability, explicitly debunking myths like "pointer arithmetic is always faster than array indexing" and de-emphasizing manual optimization that modern compilers handle better. - **The standard library gets full treatment** (Early): Chapters 21–28 cover the entire C library, with Appendix E providing a complete alphabetical reference to all C89, C99, and C11 library functions—making this a useful desk reference, not just a textbook. - **Multithreading and atomics are covered for the first time in a C book** (Opening): Chapter 28 introduces C11's threading and atomic operations, a topic rarely found in competing titles, making this edition uniquely valuable for modern systems programming. - **502 exercises with online answers support self-study** (Opening): About one-third of the exercises have solutions available online, a feature specifically requested by readers of the first edition and essential for those not taking a formal course. 【Reading Tips】 - **Skim the preface and introduction** (~0%–9%) for the book's philosophy and what's new in this edition—this will help you decide which chapters to prioritize based on your experience level. - **Deep-read Chapters 11–12 (pointers and arrays)**—these are the conceptual core of C. The book's spiral approach means you can start with the early pointer mentions in Ch. 3, but don't skip the full treatment here. - **Use the "Q&A" sections strategically**: If you're a beginner, read them after each chapter for clarification; if you're experienced, they're a great source of obscure C facts and compiler quirks. - **Treat Chapters 21–28 (standard library) as a reference** rather than reading them cover-to-cover—unless you need specific I/O, string, or threading details for a project. - **Don't skip the exercises**: The 502 problems are split into short exercises and full programming tasks; doing at least the starred ones will solidify your understanding far better than just reading. 【Coverage Limits】 This guide is based on the preface, introduction, and table of contents excerpts; it does not cover the actual content of individual chapters beyond their titles and section headings. Specific code examples, detailed explanations, and exercise content are not summarized here.
Excerpt 1
些没有选修相应大学课程却需 要检验自己工作的读者来说是非常有用的。提供了答案的练习题和编程题①都用 图标做 了标记。 数字版权声明 图灵社区的电⼦子书没有采⽤用专有客户端, 您可以在任意设备上,⽤用⾃自⼰己喜欢的浏 览器器和PDF阅读器器进⾏行行阅读。 但您购买的电⼦子书仅供您个⼈人使⽤用,未 经授权,不不得进⾏...
View in text
Page 9
点放在 32 位机和 64 位 机上。鉴于 Linux 和其他版本 UNIX 的兴起,我们会对该类操作系统给予更多关注。不 过,在可能影响到 C 程序员的场合,我们也会提到 Windows 和 macOS 操作系统的相关 方面。 引入了多线程的内容。从 C11 开始,新标准的最大变化是引入了多线程和原子操作。这...
View in text
Page 13
an Anderson-Freed、Manuel E. Bermudez、Lisa J. Brown、Steven C. Cater、Patrick Harrison、Brian Harvey、Henry H. Leitner、Darrell Long、Arthur B. Maccabe、Carolyn Rosn...
View in text
Page 15
............................................................ 95 第 7章 基本类型.............................................. 97 7.1 整数类型 ............................
View in text
Page 16
256 14.3.9 C99 中新增的预定义宏 ... 257 14.3.10 空的宏参数 .................... 258 14.3.11 参数个数可变的宏 ......... 259 14.3.12 __func__标识符 ........... 260 14.4 条件编译 ............
View in text
Page 18
..................... 373 18.8 静态断言 ......................................... 373 问与答 .............................................................. 374 练习题...
View in text
Page 19
.............. 470 23.4.4 错误 ......................................... 470 23.4.5 函数 ......................................... 471 23.4.6 分类宏 ..................
View in text
Page 20
函数 ....................... 533 26.1.3 v…scanf函数 ................... 534 26.2 <stdlib.h>:通用的实用工具 .......... 534 26.2.1 数值转换函数 ......................... 535 26...
View in text
Tags
AI categories
ProgrammingEducation
Publish Year: 2021
Language: English
File Format: PDF
File Size: 7.4 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…