
双语版C程式设计(第2版)
《双语版C程式设计(第2版)》是2017年2月电子工业出版社出版的图书,作者是Paul Kelly。
基本介绍
- 书名:双语版C程式设计
- 作者:Paul Kelly
- 原版名称:Learn C through Chinese and English
- ISBN:9787121305559
- 页数:220
- 定价:45.00
- 出版社:电子工业出版社
- 出版时间:2017年2月
- 装帧:精装
- 开本:16开
内容简介
《语版C程式设计(第2版)》这本书由在电脑程式设计方面有着丰富教学和实践经验的中外作者合作编写。共14章内容,由浅入深全面介绍C程式设计方法,包括基本数据类型和基本输出输出方式、各种控制结构和语句、指针和数组、字元串、函式、结构、档案输入和输出等内容,最后讨论了C预处理器。
本书由在电脑程式设计方面有着丰富教学和实践经验的中外作者合作编写。共14章内容,由浅入深全面介绍C程式设计方法,包括基本数据类型和基本输出输出方式、各种控制结构和语句、指针和数组、字元串、函式、结构、档案输入和输出等内容,最后讨论了C预处理器。
本书所有实例经过精心挑选、贴近生活,尤其强调读者的亲自参与意识。每章都为初学者提供了常见错误分析,所选习题可提高读者上机编程的兴趣。本书採用中英文对照混排,既方便初学者熟悉相关概念和内容,也便于英文非母语的读者熟悉英文专业辞彙。
目录
Chapter One Introduction to C(引言) 1
1.1 Brief history of C(C 语言简史) 1
1.2 Why programmers use C(为什幺程式设计师爱用C语言) 1
1.2.1 C is portable 1
1.2.2 C is a structured programming language 2
1.2.3 C is efficient 2
1.2.4 C is flexible 2
1.2.5 C is powerful 2
1.2.6 C is concise 3
1.3 Developing a C program(开发C 程式) 3
1.4 Suggestions for learning C programming(学习C 语言程式设计的建议) 4
Chapter Two C Data Types(C数据类型) 6
2.1 Constants(常量) 6
2.2 Variables(变数) 6
2.3 Simple output to the screen(简单的萤幕输出) 8
2.4 Comments(注释) 9
2.5 Data types(数据类型) 10
2.5.1 Short integer data types 10
2.5.2 Long integer data types 11
2.5.3 Unsigned integer data types 11
2.5.4 Double floating-point data type 11
2.6 Data type sizes(数据类型的大小) 11
Programming pitfalls 13
Quick syntax reference 13
Exercises 14
Chapter Three Simple Arithmetic Operations and Expressions(简单的算术运算和表达式) 16
3.1 C operators(C 运算符) 16
3.1.1 The assignment operator 16
3.1.2 Arithmetic operators 17
3.1.3 Increment and decrement operators 19
3.1.4 Combined operators 21
3.2 Operator precedence(运算符优先权) 22
3.3 Type conversions and casts(类型转换与强制类型转换) 24
Programming pitfalls 26
Quick syntax reference 27
Exercises 27
Chapter Four Keyboard Input and Screen Output(键盘输入和萤幕输出) 30
4.1 Simple keyboard input(简单的键盘输入) 30
4.2 Using a width and precision specification in printf()
[在函式printf( )中使用域宽和精度说明] 31
4.3 Single-character input and output(单个字元的输入和输出) 33
Programming pitfalls 35
Quick syntax reference 35
Exercises 36
Chapter Five Control Statements: if and switch(控制语句:if 和switch) 38
5.1 The if statement(if 语句) 38
5.2 The if-else statement(if-else 语句) 39
5.3 Logical operators(逻辑运算符) 41
5.4 Nested if statements(嵌套的if 语句) 42
5.5 The switch statement(switch 语句) 44
5.6 The conditional operator ?:(条件运算符) 46
Programming pitfalls 47
Quick syntax reference 48
Exercises 48
Chapter Six Iterative Control Statements: while, do-while, and for
(循环控制语句:while、do-while和for) 51
6.1 The while statement(while 语句) 51
6.2 The do-while loop(do-while 循环) 52
6.3 The for statement(for 语句) 54
6.4 Nested loops(嵌套的循环) 56
Programming pitfalls 58
Quick syntax reference 59
Exercises 59
Chapter Seven Arrays(数组) 61
7.1 Introduction to arrays(引言) 61
7.2 Initialising arrays(数组初始化) 66
7.3 Two-dimensional arrays(二维数组) 67
7.4 Initialising two-dimensional arrays(二维数组的初始化) 68
7.5 Multi-dimensional arrays(多维数组) 69
Programming pitfalls 70
Quick syntax reference 70
Exercises 70
Chapter Eight Pointers(指针) 73
8.1 Variable addresses(变数的地址) 73
8.2 Pointer variables(指针变数) 74
8.3 The dereference operator *(解引用运算符*) 75
8.4 Why use pointers? (为什幺使用指针) 76
Programming pitfalls 77
Quick syntax reference 77
Exercises 77
Chapter Nine Pointers and Arrays(指针和数组) 79
9.1 Pointers and one-dimensional arrays(指针和一维数组) 79
9.2 Pointers and multi-dimensional arrays(指针和多维数组) 81
9.3 Dynamic memory allocation(动态记忆体分配) 82
9.3.1 The malloc() function 82
9.3.2 The calloc() function 85
9.3.3 The realloc() function 86
9.3.4 Allocating memory for multi-dimensional arrays 87
Programming pitfalls 90
Quick syntax reference 90
Exercises 90
Chapter Ten Strings(字元串) 93
10.1 String literals(字元串) 93
10.2 Long character strings(长字元串) 94
10.3 Strings and arrays(字元串和数组) 94
10.4 Displaying a string(显示一个字元串) 95
10.5 The puts() function[puts( )函式] 97
10.6 The gets() function[gets( )函式] 98
10.7 Accessing individual characters of a string(访问字元串中的单个字元) 99
10.8 Assigning a string to a pointer (用字元串为字元指针赋值) 100
10.9 String functions(字元串处理函式) 101
10.9.1 Finding the length of a string 101
10.9.2 Copying a string 102
10.9.3 String concatenation 102
10.9.4 Comparing strings 102
10.9.5 Other string functions 103
10.10 Converting numeric strings to numbers (数值字元串向数值的转换) 103
10.11 Arrays of strings(字元串数组) 105
Programming pitfalls 108
Quick syntax reference 109
Exercises 109
Chapter Eleven Functions(函式) 112
11.1 Introduction(引言) 112
11.2 Function arguments(函式参数) 114
11.3 Returning a value from a function (从函式返回一个值) 116
11.4 Passing arguments by value (按值传参) 118
11.5 Passing arguments by reference(按引用传参) 119
11.6 Changing arguments in a function (在函式中改变实参的值) 120
11.7 Passing a one-dimensional array to a function (向函式传递一维数组) 121
11.8 Passing a multi-dimensional array to a function (向函式传递多维数组) 123
11.9 Storage classes(变数的存储类型) 124
11.9.1 auto 124
11.9.2 static 125
11.9.3 extern 126
11.9.4 register 128
11.10 Command line arguments (命令行参数) 128
11.11 Mathematical functions(数学函式) 130
11.11.1 Some commonly used trigonometric functions 130
11.11.2 Other common mathematical functions 131
11.11.3 Pseudo-random number functions 132
11.11.4 Some time-related functions 132
11.12 Recursion 133
Programming pitfalls 136
Quick syntax reference 137
Exercises 137
Chapter Twelve Structures(结构体) 141
12.1 Defining a structure(定义结构体) 141
12.2 Pointers to structures(结构体指针) 144
12.3 Initialising a structure variable (结构体变数的初始化) 145
12.4 Passing a structure to a function (向函式传递结构体变数) 147
12.5 Nested structures(嵌套的结构体) 149
12.6 Including a structure template from a file (从档案中引用结构体模板) 150
12.7 The typedef statement (typedef 语句) 151
12.8 Arrays of structures(结构体数组) 152
12.9 Enumerated data types(枚举数据类型) 158
Programming pitfalls 160
Quick syntax reference 161
Exercises 162
Chapter Thirteen File Input and Output(档案的输入和输出) 165
13.1 Binary and ASCII (text) files [二进制档案和ASCII(文本)档案] 165
13.2 Opening and closing files (档案的打开和关闭) 166
13.3 Reading a character from a file using fgetc()
[使用函式fgetc( )从档案中读字元] 168
13.4 Writing a character to a file using fputc()
[使用函式fputc( )向档案中写字元] 170
13.5 Reading a string of characters from a file using fgets()
[使用函式fgets( )从档案中读字元串] 171
13.6 Writing a string of characters to a file using fputs()
使用函式fputs( )向档案中写字元串] 172
13.7 Formatted input-output to a file using fscanf() and fprintf() 173
[使用函式fscanf( )和fprintf( )进行档案的格式化读写] 173
13.8 The standard files(标準档案) 174
13.9 Block input-output using fread() and fwrite() 175
[使用函式fread( )和fwrite( )进行块读写] 175
13.10 Rewinding a file using rewind()[使用函式rewind( )对档案重定位] 177
13.11 Random access of files using fseek() [使用函式fseek( )随机访问档案] 179
13.12 Finding the position in a file using ftell()
[使用函式ftell( )查找档案的当前位置] 184
13.13 Deleting a file using remove()[使用函式remove( )删除档案] 184
Programming pitfalls 185
Quick syntax reference 186
Exercises 187
Chapter Fourteen The C Preprocessor(C编译预处理) 190
14.1 Including files(包含档案) 190
14.2 Defining macros(定义宏) 191
14.3 Macro parameters(带参数的宏) 192
14.4 Macros and functions(宏和函式) 194
14.5 Some useful macros(一些有用的宏) 195
14.6 Conditional directives(条件编译预处理指令) 195
14.7 Character-testing macros(字元检测宏) 196
14.8 The assert() macro [assert() 宏] 197
Programming pitfalls 200
Quick syntax reference 200
Exercises 200
Appendix A List of C Keywords 202
Appendix B Precedence and Associativity of C Operators 203
Appendix C ASCII Character Codes 205
Appendix D Fundamental C Built-in Data Types 207