Chapter 1. Getting Ready
Whence C?
Dennis Ritchie of Bell Labs created C in 1972 as he and Ken Thompson worked on designing the Unix operating
system.C didn't spring full-grown from Ritchie's head, however. It came from Thompson's B language.
Why C?
Design Features:Efficiency,Portability,Power and Flexibility,Programmer Oriented
Shortcomings:pointers cause errors difficult to trace, Obfuscated Code contest
Whither C?
C++ is nearly a superset of C, meaning that any C program is, or nearly is, a valid C++ program, too.
What Computers Do
First, everything stored in a computer is stored as a number.
Second, computer programs ultimately have to be expressed in this numeric instruction code, or what is called
machine language.
High-level Computer Languages and Compilers
High-level languages, such as C, Java, and Pascal, describe actions in a more abstract form and aren't tied
to a particular CPU or instruction set.
Also, high-level languages are easier to learn and much easier to program in than are machine languages.
Using C: Seven Steps
The moral here is that you should develop the habit of planning before coding.
Programing Mechanics
An object file and an executable file both consist of machine language instructions.
However, the object file contains the machine language translation only for the code you used, but the
executable file also has machine code for the library routines you use and for the startup code.
Language Standards
The first edition of The C Programming Language by Brian Kernighan and Dennis Ritchie (1978) became the
accepted standard, usually referred to as K&R C or classic C.
The "C Reference Manual" in that book's appendix acted as the guide to C implementations.
However, although this appendix defined the C language, it did not define the C library.
In the absence of any official standard, the library supplied with the Unix implementation became a defacto
standard.
The First ANSI/ISO Standard:
American National Standards Institute (ANSI) established a committee (X3J11) in 1983 to develop a new
standard, which was adopted formally in 1989. This new standard (ANSI C) defines both the language and
a standard C library. The International Organization for Standardization adopted a C standard (ISO C)
in 1990. ISO C and ANSI C are essentially the same standard. The final version of the ANSI/ISO standard
is often referred to as C89 (because that's when ANSI approval came) or C90 (because that's when ISO
approval came). Also, because the ANSI version came out first, people often used the term ANSI C.
The C99 Standard:
In 1994, work began on revising the standard, an effort that resulted in the C99 standard.
These three points—internationalization, correction of deficiencies, and improvement of computational
usefulness—were the main change-oriented goals.
The upshot is that C99 changes preserve the essential nature of C, and C remains a lean, clean, efficient
language.
Most compilers at this time don't fully implement all the C99 changes(in 2004)
Summary
C is a powerful, concise programming language. It is popular because it offers useful programming tools
and good control over hardware and because C programs are easier than most to transport from one system
to another.
C is a compiled language. C compilers and linkers are programs that convert C language source code into
executable code.
Programming in C can be taxing, difficult, and frustrating, but it can also be intriguing, exciting, and
satisfying.
Review Questions
1: What does portability mean in the context of programming?
A1: A perfectly portable program is one whose source code can, without modification, be compiled to a
successful program on a variety of different computer systems.
2: Explain the difference between a source code file, object code file, and executable file.
A2: A source code file contains code as written in whatever language the programmer is using. An object
code file contains machine language code; it need not be the code for a complete program. An executable
file contains the complete code, in machine language, constituting an executable program.
3: What are the seven major steps in programming?
A3:
Defining program objectives.
Designing the program.
Coding the program.
Compiling the program.
Running the program.
Testing and debugging the program.
Maintaining and modifying the program.
4: What does a compiler do?
A4: A compiler translates source code (for example, code written in C) to the equivalent machine language
code, also termed object code.
5: What does a linker do?
A5: The linker combines translated source code with library code and start-up code to produce an executable
program.
分享到:
相关推荐
《C++ Primer Plus》是Stephen Prata撰写的一本广受欢迎的C++编程教材,第六版提供了深入浅出的C++语言教程,旨在帮助初学者和有一定经验的程序员掌握这一强大的编程语言。附录中的源码文件是作者为配合书中的教学...
C Primer Plus (第六版)复习题参考答案
在C语言中,变长数组(Variable Length Arrays,简称VLA)是C99标准引入的一个新特性。传统的C语言中,数组的...通过阅读C Primer Plus,你可以获取更多关于VLA和其他C语言特性的详细信息,帮助你提升C语言编程技能。
【C Primer Plus 学习笔记】 在深入探讨C语言的知识点之前,首先理解C Primer Plus是一本经典的C语言教程,它涵盖了从基础到高级的C语言概念。通过半个月的学习,我们可以获得对C语言的全面认识。 **数据处理** 在...
《C Primer Plus》是Stephen Prata撰写的一本...通过阅读《C Primer Plus》并整理笔记,读者不仅可以全面理解C语言的基础知识,还能进一步提升编程技能,为将来深入学习操作系统、网络编程等高级主题打下坚实的基础。
C++ primer plus学习笔记.md
### C Primer Plus 读书笔记知识点总结 #### 一、`scanf()`与`gets()`的使用区别 - **`scanf()`特点**: - 当遇到第一个空白字符(如空格、制表符或换行符)时停止读取。 - 自动在字符串末尾插入空字符`\0`。 -...
C_Primer_Plus_6.16.18.c
C_Primer_Plus_6.16.13.c
C_Primer_Plus_6.16.12.c
C++ primer Plus的pdf资源
开始学习C Primer Plus(C语言入门指南)_C-Primer-Plus-bootcamp
《C Primer Plus》是Stephen Prata撰写的一本经典C语言教程,它为初学者和有经验的程序员提供了全面而深入的C语言学习资料。这本书涵盖了C语言的基础到高级概念,包括变量、数据类型、运算符、控制结构、函数、数组...
C++primerplus笔记.pdf
根据提供的文件信息,我们可以从中提炼出关于《C Primer Plus(第五版)》这本书的相关知识点,主要包括书籍的基本信息、作者介绍以及部分章节的内容概览。以下是对这些知识点的详细阐述: ### 书籍基本信息 - **...
《C Primer Plus编程答案清晰完整版》是一份详尽的资源,旨在帮助学习者深入理解和掌握C语言。这本书是Stephen Prata所著的《C Primer Plus》的配套解答,为读者提供了书中各练习题的解决方案,确保了学习过程的全面...
《C++ Primer Plus 第6版》是一本深受程序员喜爱的C++学习书籍,它深入浅出地介绍了C++编程语言的基础知识和高级特性。这本书的配套示例代码库"example.zip"包含了丰富的实例,旨在帮助读者更好地理解和掌握C++编程...