1 C 语言概述······························································································································1
1.1 C语言的发展过程········································································································1
1.2 当代最优秀的程序设计语言·······················································································1
1.3 C语言版本···················································································································1
1.4 C语言的特点···············································································································1
1.5 面向对象的程序设计语言···························································································2
1.6 C和C++···················································································································2
1.7 简单的C程序介绍·······································································································2
1.8 输入和输出函数··········································································································4
1.9 C源程序的结构特点····································································································5
1.10 书写程序时应遵循的规则·························································································5
1.11 C语言的字符集··········································································································5
1.12 C语言词汇·················································································································5
1.13 Turbo C 2.0集成开发环境的使用··············································································7
1.13.1 Turbo C 2.0简介和启动···················································································7
1.13.2 Turbo C 2.0集成开发环境···············································································7
1.13.3 File 菜单···········································································································8
1.13.4 Edit 菜单···········································································································9
1.13.5 Run 菜单·········································································································10
1.13.6 Compile 菜单··································································································11
1.13.7 Project 菜单····································································································12
1.13.8 Options 菜单···································································································13
1.13.9 Debug 菜单·····································································································17
1.13.10 Break/watch 菜单··························································································18
1.13.11 Turbo C 2.0的配置文件···············································································19
2 程序的灵魂—算法················································································································20
2.1 算法的概念················································································································20
2.2 简单算法举例············································································································20
2.3 算法的特性················································································································23
2.4 怎样表示一个算法·····································································································23
2.4.1 用自然语言表示算法······················································································23
2.4.2 用流程图表示算法··························································································23
2.4.3 三种基本结构和改进的流程图······································································27
2.4.4 用 N-S流程图表示算法··················································································28
2.4.5 用伪代码表示算法··························································································29
2.4.6 用计算机语言表示算法··················································································30
2.5 结构化程序设计方法·································································································30
3 数据类型、运算符与表达式·································································································31
3.1 C语言的数据类型······································································································31
3.2 常量与变量················································································································32
3.2.1 常量和符号常量······························································································32
3.2.2 变量·················································································································33
3.3 整型数据····················································································································33
3.3.1 整型常量的表示方法······················································································33
3.3.2 整型变量·········································································································34
3.4 实型数据····················································································································37
3.4.1 实型常量的表示方法······················································································37
3.4.2 实型变量·········································································································38
3.4.3 实型常数的类型······························································································39
3.5 字符型数据················································································································39
3.5.1 字符常量·········································································································39
3.5.2 转义字符·········································································································40
3.5.3 字符变量·········································································································41
3.5.4 字符数据在内存中的存储形式及使用方法···················································41
3.5.5 字符串常量······································································································42
3.6 变量赋初值················································································································42
3.7 各类数值型数据之间的混合运算·············································································43
3.8 算术运算符和算术表达式·························································································44
3.8.1 C 运算符简介···································································································45
3.8.2 算术运算符和算术表达式··············································································45
3.9 赋值运算符和赋值表达式·························································································47
3.10 逗号运算符和逗号表达式·······················································································49
3.11 小结··························································································································49
3.11.1 C的数据类型·································································································49
3.11.2 基本类型的分类及特点················································································49
3.11.3 常量后缀········································································································50
3.11.4 常量类型········································································································50
3.11.5 数据类型转换································································································50
3.11.6 运算符优先级和结合性················································································50
3.11.7 表达式············································································································50
4 最简单的 C程序设计—顺序程序设计················································································51
4.1 C语句概述·················································································································51
4.2 赋值语句····················································································································52
4.3 数据输入输出的概念及在 C 语言中的实现·····························································53
4.4 字符数据的输入输出·································································································54
4.4.1 putchar 函数(字符输出函数)·····································································54
4.4.2 getchar函数(键盘输入函数)·······································································54
4.5 格式输入与输出········································································································55
4.5.1 printf 函数(格式输出函数)·········································································55
4.5.2 scanf 函数(格式输入函数) ···············································································58
4.6 顺序结构程序设计举例·····························································································62
5 分支结构程序························································································································64
5.1 关系运算符和表达式·································································································64
5.1.1 关系运算符及其优先次序··············································································64
5.1.2 关系表达式······································································································64
5.2 逻辑运算符和表达式·································································································65
5.2.1 逻辑运算符极其优先次序··············································································65
5.2.2 逻辑运算的值··································································································65
...
C语言是在 70 年代初问世的。一九七八年由美国电话电报公司(AT&T)贝尔实验室正式发表了C语言。同时由 B.W.Kernighan 和 D.M.Ritchit 合著了著名的“THE C PROGRAMMING LANGUAGE”一书。通常简称为《K&R》 ,也有人称之为《K&R》标准。
但是, 在 《K&R》 中并没有定义一个完整的标准 C 语言, 后来由美国国家标准协会 (American National Standards Institute)在此基础上制定了一个 C 语言标准,于一九八三年发表。通常称之为 ANSI C。
1.2 当代最优秀的程序设计语言
早期的 C 语言主要是用于 UNIX 系统。由于C语言的强大功能和各方面的优点逐渐为人们认识,到了八十年代,C 开始进入其它操作系统,并很快在各类大、中、小和微型计算机上得到了广泛的使用,成为当代最优秀的程序设计语言之一。