说明
本文是个人学习用的非官方中英对照译文,原文:https://diveintosystems.org/book/Appendix1/summary.html。
原书采用 CC BY-NC-ND 4.0 许可(禁止演绎),请勿公开传播本译文。
标为「译注」「现代更新」的内容是译者补充,不代表原书作者观点;代码与原文逐字一致,未作改动。
16.7. Summary
在本章中,我们通过与许多读者可能熟悉的 Java 语言中类似的语言结构进行比较,介绍了 C 语言的许多部分。C 具有与许多其他高级命令式和面向对象编程语言相似的语言特性,包括变量、循环、条件语句、函数和 I/O。我们讨论过的 C 与 Java 特性之间的一些关键区别包括:C 是命令式、过程式的语言,而 Java 是面向对象的语言;C 的数组和字符串是比 Java 的数组、ArrayList、List 和 String 类更底层的抽象;Java 有包含复杂类型的大量类库,而 C 是一种更小的语言,提供的是更底层的抽象。更底层的抽象让 C 程序员能更多地控制程序如何访问内存,从而更多地控制程序的效率。
In this chapter, we introduced many parts of the C programming language by comparing them to similar language constructs in Java, a language that many readers might know. C has similar language features to those of many other high-level imperative and object-oriented programming languages, including variables, loops, conditionals, functions, and I/O. Some key differences between the C and Java features we discussed include that C is a imperative and procedural language and Java is an object-oriented language, that C arrays and strings are a lower-level abstraction than Java’s array, ArrayList, List, and String classes, and that Java has an extensive class library of complex types whereas C is a smaller language with lower-level abstractions. The lower-level abstractions allow a C programmer more control over how their program accesses its memory and thus more control over their program’s efficiency.
在第 2 章中,我们会详细介绍 C 语言。我们会更深入地重温本章介绍的许多语言特性,并介绍一些新的 C 语言特性,其中最值得注意的是 C 的指针变量以及对动态内存分配的支持。
In Chapter 2 we cover the C programming language in detail. We revisit in more depth the many language features presented in this chapter, and we introduce some new C language features, most notably C pointer variables and support for dynamic memory allocation.