第 14 / 187 篇

1.7. 小结

说明

本文是个人学习用的非官方中英对照译文,原文:https://diveintosystems.org/book/C1-C_intro/summary.html。
原书采用 CC BY-NC-ND 4.0 许可(禁止演绎),请勿公开传播本译文。
标为「译注」「现代更新」的内容是译者补充,不代表原书作者观点;代码与原文逐字一致,未作改动。

1.7. Summary

在本章中,我们通过与 Python(许多读者可能了解的一门语言)中类似的语言构造作对比,介绍了 C 语言的许多组成部分。C 具有与许多其他高级命令式和面向对象编程语言相似的语言特性,包括变量、循环、条件语句、函数和 I/O。我们讨论过的 C 与 Python 特性之间的一些关键区别包括:C 要求所有变量在使用前都声明为特定类型;C 的数组和字符串是比 Python 的列表和字符串更底层的抽象。更底层的抽象让 C 程序员对程序如何访问内存有更多的控制,从而对程序的效率也有更多的控制。

In this chapter, we introduced many parts of the C programming language by comparing them to similar language constructs in Python, 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 Python features we discussed include C requiring that all variables be declared of a specific type before they’re used, and that C arrays and strings are a lower-level abstraction than Python’s lists and strings. 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.

下一章我们将详细讲解 C 语言。我们会更深入地回顾本章介绍的许多语言特性,并介绍 C 语言的一些新特性,其中最值得注意的是 C 的指针变量以及对动态内存分配的支持。

In the next chapter, 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.