《The C Programming Language》的原文摘录

  • "相对于#define语句来说,它的优势在于常量值可以自动生成。尽管可以声明enum类型的变量,但编译器不检查这种类型的变量中存储的值是否为该枚举的有效值。不过,枚举变量提供这种检查,因此枚举比#define更具优势。此外,调试程序可以以符号形式打印出枚举变量的值"; (查看原文)
    Cennial 2回复 2赞 2012-09-12 15:02:49
    —— 引自第1页
  • If a name that has not been previously declared occurs in an expression and is followed by a left parenthesis, it is declared by context to be a function name, the function is assumed to return an int, and nothing is assumed about its arguments. Furthermore, if a function declaration does not include arguments, as in double atof(); that too is taken to mean that nothing is to be assumed about the arguments of atof; all parameter checking is turned off. This special meaning of the empty argument list is intended to permit older C programs to compile with new compilers. But it’s a bad idea to use it with new programs. If the function takes arguments, declare them; if it takes no arguments, use void. (查看原文)
    RednaxelaFX 1赞 2016-12-20 06:25:56
    —— 引自第72页
  • float类型通常是32位,它至少有6位有效数字,取值范围一般在10^-38 ~ 10 ^ 38之间 (查看原文)
    eddyzhou 1回复 8赞 2011-02-13 11:45:27
    —— 引自第4页
  • BCPL and B are "typeless" languages. By contrast, C provides a variety of data types. The fundamental types are characters, and integers and floating-point numbers of several sizes. In addition, there is a hierarchy of derived data types created with pointers, arrays, structures, and unions. Expressions are formed from operators and operands; any expression, including an assignment or a function call, can be a statement. Pointers provide for machine-independent address arithmetic. (查看原文)
    Grissiom 2011-02-17 10:33:57
    —— 引自第1页
  • Right shifting a signed quantity will fill sign bits ("arithmetic shift") or on some machines ans with 0-bits ("logical shift") on others (查看原文)
    Grissiom 2011-02-18 14:55:31
    —— 引自第50页
  • Declaring the argument x to be unsigned ensures that when it is right-shifted, vacated bits will be filled with zeros, not sign bits, regardless of the machine the program run on. (查看原文)
    Grissiom 2011-02-18 14:55:31
    —— 引自第50页
  • char *fgets(char *line, int maxline, FILE *fp) fgets reads the next input line (including the newline) from file fp into the character array line; at most maxline-1 characters will be read. The resulting line is terminated with '\0'. Normally fgets returns line; on end of file or error it returns NULL. (查看原文)
    candy 2011-05-11 17:38:54
    —— 引自第146页
  • void *realloc(void *p, size_t size) realloc changes the size of the object pointed to by p to size. The contents will be unchanged up to the minimum of the old and new sizes. If the new size is larger, the new space is uninitialized. realloc returns a pointer to the new space, or NULL if the request cannot be satisfied, in which case *p is unchanged. (查看原文)
    candy 2011-05-11 17:46:03
    —— 引自第230页
  • char *strtok(s,ct) strtok searches s for tokens delimited by characters from ct; see below. A sequence of calls of strtok(s,ct) splits s into tokens, each delimited by a character from ct. The first call in a sequence has a non-NULL s, it finds the first token in s consisting of characters not in ct; it terminates that by overwriting the next character of s with '\0' and returns a pointer to the token. Each subsequent call, indicated by a NULL value of s, returns the next such token, searching from just past the end of the previous one. strtok returns NULL when no further token is found. The string ct may be different on each call. (查看原文)
    candy 2011-05-11 17:52:45
    —— 引自第228页
  • The valid pointer operation are assignment of pointers of the same type,adding or subtracting a pointer and an integer,subtracting or comparing two pointers to members of the same array,and assigning or comparing to zero.All other pointer arithmetic is illegal.It is not legal to add two pointers,or to multiply or divide or shift or mask them,or to add float or double to them,or even,except for void *,to assign a pointer of one type to pointer of another type without a cast. (查看原文)
    Yuyu 2011-10-30 22:12:55
    —— 引自第93页
  • it is important to understand them,and,if necessary,how to create them. (查看原文)
    Yuyu 2011-11-14 16:09:56
    —— 引自第122页
  • A character written between single quotes represents an integer value equal to the numerical value of the character in the machine's character set. (查看原文)
    Zane 2012-04-04 14:43:20
    —— 引自第11页
  • The fundamental types are charaters, and integers and floatingpoint number of serveral sizes. The language does not define any storage allocation facility other than static definiction and the stack discipline provided by the local variables of functions, there is no heap or grabage collection. Similarly, C offers only straightfowward, single-thread control flow: tests, loops, grouping and subprograms, but not multiprogramming, parallel operations, synchronization, or coroutines. .. keeping the lalnguage down to the modest size has real benefits. (查看原文)
    [已注销] 2012-08-23 20:14:40
    —— 引自章节:Introduction
  • The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages. C functions are like the subroutines and functions of Fortan or the procedures and functions of Pascal. ... "main" is special -- your program begins executing at the beginning of main. Notice that \n represents only a single character. An escape sequence like \n provides a general and extensible mechanism for representing hard-to-type or invisible characters. ... a comment, which in this case explains briefly what that program does. Comments may appear anywhere a blank or tab or newline can. In C, all variables must be delcared before they are used... The range of both int and float depends on the machine you are using. The sizes of these objects ... (查看原文)
    [已注销] 2012-08-29 09:56:10
    —— 引自章节:Chapter 1: A Tutorial Introduc
  • "相对于#define语句来说,它的优势在于常量值可以自动生成。尽管可以声明enum类型的变量,但编译器不检查这种类型的变量中存储的值是否为该枚举的有效值。不过,枚举变量提供这种检查,因此枚举比#define更具优势。此外,调试程序可以以符号形式打印出枚举变量的值"; (查看原文)
    Cennial 2012-09-12 14:54:38
    —— 引自第31页
  • 逗号运算符",",也是C语言优先级最低的运算符,在for语句中经常会用到它。被逗号分隔的一对表达式将按照从左到右的顺序进行求值,各表达式右边的操作数的类型和值即为其结果的类型和值。 (查看原文)
    Cennial 2012-09-15 17:46:11
    —— 引自第52页
  • Chapter 7 describes the standard library, which provides a common interface to the operating system. This library is defined by the ANSI standard. (查看原文)
    penn.z 2013-01-04 14:47:19
    —— 引自第4页
  • 如果程序包含在多个源文件中,而某个变量在file1文件中定义,在file2和file3文件中使用,那么在文件file2和file3中就需要使用extern声明来建立该变量与其定义之间的联系。人们通常把变量和函数的extern声明放在一个单独的文件中(习惯称之为头文件),并在每个源文件的开头使用#include语句把所要用的头文件包含进来。后缀名.h约定为头文件名的扩展名。 (查看原文)
    longsail 2013-01-30 13:01:09
    —— 引自第24页
  • Although variables of enum types may be declared, compilers need not check that what you store in such a variable is a valid value for the enumeration. Nevertheless, enumeration variables offer the chance of checking and so are often better than #define s. (查看原文)
    队长 2013-03-04 10:42:46
    —— 引自章节:2.3 Constants - 关于枚举
  • /var/mobile/Applications/EB08C200-B1B8-4FDE-B8E5-2ECA2B4EB979/Documents/fahr.c(2) : error : main : undeclared identifier (查看原文)
    maemo 2013-04-28 23:17:47
    —— 引自第4页
<前页 1 2 3 4 后页>