The C Programming Language 读书笔记(Chapter 1)
来源:互联网 发布:淘宝特产店名大全 编辑:程序博客网 时间:2024/05/16 19:40
In this Chapter, a lot of examples are presented to introduce the basics used to write useful programs.
包括:Variables and Arithmetic, the for statement, Symbolic constants, Character input and output, Arrays,
Functions, Arguments, Character Arrays, External Variables.
这些知识很多知识复习而已。编了这么久的程序,这些知识还是掌握了。
这章包含了许多基本的概念,主要有:
functions, variables, statements, arguments, character string (= string constant)
loops, formatted output, symbolic constants (使用#define以去掉programs中的magic Numbers)
text stream, character constants (between single qutote), Arrays, function prototype,
call by value, call by reference, external variables and scope, automatic variables.
文件处理的常见模式char by char为:
int c;
while ((c = getchar()) != EOF) {
if (c 满足条件) {
... // 处理
}
... // putchar(c);
}
文本处理常见模式word by word为:
int c, state;
state = OUT;
whiel ((c = getchar()) != EOF) {
if (c == ' ' || c == '/n' || c == '/t')
state = OUT;
else if (state == OUT) {
state = IN;
}
if (state == IN) {
... // c为当前word中的字符
}
}
文本处理常见模式line by line为:
#define MAXLINE 1000 /* maximum input line length */
int getline(char line[], int maxline);
int len; /* current line length */
char line[MAXLINE]; /* current input line */
while ((len = getline(line, MAXLINE)) > 0) {
... // 处理line
}
/* getline: read a line into s, return length */
int getline(char s[], int lim)
{
int c, i;
for (i=0;i < lim-1 && (c=getchar())!=EOF && c!='/n';++i)
s[i] = c;
if (c == '/n') {
s[i] = c;
++i;
}
s[i] = '/0';
return i;
}
动词:
write (programs)
create, compile, load, run (programs)
on the Unix operating system
type (command)
print
call (functions)
define (function, variables)
declare (...)
in braces ({})
indent (statements)
read, write (characters, lines)
return (values)
execute
terminate
- The C Programming Language 读书笔记(Chapter 1)
- The C++ Programming Language Chapter 3 ( 读书笔记)
- 《The C Programming Language》读书笔记1
- 《The C Programming Language》读书笔记1
- The C Programming Language——Exercise solutions of the chapter one (1st)
- C程序设计语言(The C Programming Language) 读书笔记
- TCPL(The C Programming Language)读书笔记 第一章导言
- TCPL(The C Programming Language)读书笔记 第六章 结构
- 《The C Programming Language》读书笔记 说明
- 《The C Programming Language》读书笔记2
- 《The C Programming Language》读书笔记3
- 《The C Programming Language》读书笔记4
- 《The C Programming language》读书笔记5
- 《The C Programming Language》读书笔记 说明
- 《The C Programming Language》第一章读书笔记
- 《THE C PROGRAMMING LANGUAGE》读书笔记一
- 《THE C PROGRAMMING LANGUAGE》读书笔记二
- The C programming language --第一章 基本概念读书笔记
- 如何在网页中嵌套flash
- webwork doubleselect 级联 处理
- LCC使用介绍
- VC无闪烁刷屏技术的实现---经验总结之防止窗口闪烁的方法
- NET 连接池救生员
- The C Programming Language 读书笔记(Chapter 1)
- sqlhelper使用指南
- eclipse无法新建java project
- PostgreSQL
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(12):第二阶段的程序入口
- LCC-win32与C编程简介
- javax.servlet.ServletException: BeanUtils.populate
- vs2003 asp.net服务端压缩文件并下载
- Symbian中的iScanCode和iCode