小志对《The C Programming Language》的笔记(3)

The  C Programming Language
  • 书名: The C Programming Language
  • 作者: Brian W. Kernighan/Dennis M. Ritchie
  • 副标题: -
  • 页数: 274
  • 出版社: Prentice Hall
  • 出版年: 1988-4-1
  • 第5页
    We want to get you as quickly as possible to the point where you can write useful programs, and to do that we have to concentrate on the basics: variables and constants, arithmetic, control flow, functions, and the rudiments of input and output. We are intentionally leaving out of this chapter features of C that are important for writing bigger programs.
    一本理想的教授编程语言的书就应该以这种方式编写:一开始就把最基本、最重要的内容拿上来,简单讲述,把细节留到后面章节再讲;应该以完整而且有趣的例子展示语言的内容,而不是唠唠叨叨陈述概念。
    2017-02-04 10:37:44 回应
  • 第15页
    We are now going to consider a family of related programs for processing character data. You will find that many programs are just expanded versions of the prototypes that we discuss here.
    字符或者字符串操作算是使用C所能做到的最简单而有趣的事情。因为C当中的字符串并非immutable,所以给了我们可以操作字符串中单个字符的机会,这就可以做一些有趣的算法了。
    2017-02-04 12:29:35 回应
  • 第19页
    A word of caution: newcomers to C occasionally write = when they mean ==. As we will see in Chapter 2, the result is usually a legal expression, so you will get no warning.
    一个好的习惯是把常量放在左边,如
    if ('\n' == c)
    
    这样,当你把`==`误写为`=`的时候,编译器会报错。
    2017-02-04 13:52:59 回应

小志的其他笔记  · · · · · ·  ( 全部14条 )