《雙語版C程式設計(Learn C through English and Chinese)》是2013年3月電子工業出版社出版的圖書,作者是(愛爾蘭)Paul Kelly(P. 凱利)、蘇小紅。
基本介紹
- 中文名:雙語版C程式設計(Learn C through English and Chinese)
- 作者:(愛爾蘭)Paul Kelly(P. 凱利)、蘇小紅
- 出版時間:2013年3月
- 出版社:電子工業出版社
- ISBN:9787121190438
- 類別:240頁
- 定價:35 元
- 開本:16 開
內容簡介,圖書目錄,
內容簡介
本書由在電腦程式設計方面有著豐富教學和實踐經驗的中外作者合作編寫。共分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 3
1.2.6 C is concise 3
1.3 Developing a C program(開發C程式) 3
1.4 Suggestions for learning C Programming(學習C語言程式設計的建議) 5
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 11
2.5.2 Long integer data types 11
2.5.3 Unsigned integer data types 11
2.5.4 Double floating-point data type 12
2.6 Data type sizes(數據類型的大小) 12
Programming pitfalls14
Quick syntax reference 15
Exercises 15
Chapter Three Simple Arithmetic Operations and Expressions(簡單的算術運算和表達式) 17
3.1 C operators(C運算符) 17
3.1.1 The assignment operator 17
3.1.2 Arithmetic operators 18
3.1.3 Increment and decrement operators 20
3.1.4 Combined operators 23
3.2 Operator precedence(運算符優先權) 24
3.3 Type conversions and casts(類型轉換與強制類型轉換) 26
Programming pitfalls 28
Quick syntax reference 29
Exercises 29
Chapter Four Keyboard Input and Screen Output(鍵盤輸入和螢幕輸出) 32
4.1 Simple keyboard input(簡單的鍵盤輸入) 32
4.2 Using a width and precision specification in printf( )
[在函式printf( )中使用域寬和精度說明] 34
4.3 Single-character input and output(單個字元的輸入和輸出) 35
Programming pitfalls 37
Quick syntax reference 38
Exercises 38
Chapter Five Control Statements: If and Switch(控制語句:if和switch) 40
5.1 The if statement(if語句) 40
5.2 The if-else statement(if-else語句) 41
5.3 Logical operators(邏輯運算符) 43
5.4 Nested if statements(嵌套的if語句) 44
5.5 The switch statement(switch語句) 46
5.6 The conditional operator ?:(條件運算符) 48
Programming pitfalls 50
Quick syntax reference 51
Exercises 52
Chapter Six Iterative Control Statements: while, do-while, and for
(循環控制語句:while、do-while和for) 54
6.1 The while statement(while語句) 54
6.2 The do-while loop(do-while循環) 56
6.3 The for statement(for語句) 57
6.4 Nested loops(嵌套的循環) 59
Programming pitfalls 62
Quick syntax reference 63
Exercises 63
Chapter Seven Arrays(數組) 65
7.1 Introduction to arrays(引言) 65
7.2 Initialising arrays(數組初始化) 71
7.3 Two-dimensional arrays(二維數組) 72
7.4 Initialising two-dimensional arrays(二維數組的初始化) 74
7.5 Multi-dimensional arrays(多維數組) 75
Programming pitfalls 76
Quick syntax reference 76
Exercises 77
Chapter Eight Pointers(指針) 79
8.1 Variable addresses(變數的地址) 79
8.2 Pointer variables(指針變數) 80
8.3 The dereference operator *(解引用運算符*) 81
8.4 Why use pointers? (為什麼使用指針) 82
Programming pitfalls 83
Quick syntax reference 83
Exercises 83
Chapter Nine Pointers and Arrays(指針和數組) 85
9.1 Pointers and one-dimensional arrays(指針和一維數組) 85
9.2 Pointers and multi-dimensional arrays(指針和多維數組) 87
9.3 Dynamic memory allocation(動態記憶體分配) 89
9.3.1 The malloc( ) function 89
9.3.2 The calloc( ) function 92
9.3.3 The realloc( ) function 93
9.3.4 Allocating memory for multi-dimensional arrays 95
Programming pitfalls 98
Exercises 99
Chapter Ten Strings(字元串) 101
10.1 String literals(字元串) 101
10.2 Long character strings(長字元串) 102
10.3 Strings and arrays(字元串和數組) 103
10.4 Displaying a string(顯示一個字元串) 104
10.5 The puts( ) function[puts( )函式] 105
10.6 The gets( ) function[gets( )函式] 106
10.7 Accessing individual characters of a string(訪問字元串中的單個字元) 107
10.8 Assigning a string to a pointer(用字元串為字元指針賦值) 108
10.9 String functions(字元串處理函式) 110
10.9.1 Finding the length of a string 110
10.9.2 Copying a string 110
10.9.3 String concatenation 111
10.9.4 Comparing strings 111
10.9.5 Other string functions 112
10.10 Converting numeric strings to numbers(數值字元串向數值的轉換) 113
10.11 Arrays of strings(字元串數組) 114
Programming pitfalls 117
Quick syntax reference 118
Exercises 119
Chapter Eleven Functions(函式) 121
11.1 Introduction(引言) 121
11.2 Function arguments(函式參數) 123
11.3 Returning a value from a function(從函式返回一個值) 126
11.4 Passing arguments by value(按值傳參) 128
11.5 Passing arguments by reference(按引用傳參) 129
11.6 Changing arguments in a function(在函式中改變實參的值) 130
11.7 Passing a one-dimensional array to a function(向函式傳遞一維數組) 132
11.8 Passing a multi-dimensional array to a function(向函式傳遞多維數組) 134
11.9 Storage classes(變數的存儲類型) 135
11.9.1 auto135
11.9.2 static136
11.9.3 extern137
11.9.4 register139
11.10 Command line arguments(命令行參數) 140
11.11 Mathematical functions(數學函式) 142
11.11.1 Some commonly used trigonometric functions 142
11.11.2 Other common mathematical functions 143
11.11.3 Pseudo-random number functions 144
11.11.4 Some time-related functions 144
11.12 Recursion 146
Programming pitfalls 149
Quick syntax reference 150
Exercises 151
Chapter Twelve Structures(結構體) 155
12.1 Defining a structure(定義結構體) 155
12.2 Pointers to structures(結構體指針) 159
12.3 Initialising a structure variable(結構體變數的初始化) 160
12.4 Passing a structure to a function(向函式傳遞結構體變數) 162
12.5 Nested structures(嵌套的結構體) 164
12.6 Including a structure template from a file(從檔案中引用結構體模板) 166
12.7 The typedef statement(typedef語句) 166
12.8 Arrays of structures(結構體數組) 168
12.9 Enumerated data types(枚舉數據類型) 174
Programming pitfalls 176
Exercises 178
Chapter Thirteen File Input and Output(檔案的輸入和輸出) 181
13.1 Binary and ASCII (text) files[二進制檔案和ASCII(文本)檔案] 181
13.2 Opening and closing files(檔案的打開和關閉) 182
13.3 Reading a character from a file using fgetc( )[使用函式fgetc( )從檔案中讀字元] 185
13.4 Writing a character to a file using fputc( )[使用函式fputc( )向檔案中寫字元] 186
13.5 Reading a string of characters from a file using fgets( )
[使用函式fgets( )從檔案中讀字元串] 187
13.6 Writing a string of characters to a file using fputs( )
[使用函式fputs( )向檔案中寫入字元串] 189
13.7 Formatted input-output to a file using fscanf( ) and fprintf( )
[使用函式fscanf( )和fprintf( )進行檔案的格式化讀寫] 190
13.8 The standard files(標準檔案) 192
13.9 Block input-output using fread( ) and fwrite( )
[使用函式fread( )和fwrite( )進行塊讀寫] 193
13.10 Rewinding a file using rewind( )[使用函式rewind( )對檔案重定位] 195
13.11 Random access of files using fseek( )[使用函式fseek( )隨機訪問檔案] 197
13.12 Finding the position in a file using ftell( )
[使用函式ftell( )查找檔案的當前位置] 203
13.13 Deleting a file using remove( )[使用函式remove( )刪除檔案] 203
Programming pitfalls 204
Quick syntax reference 205
Exercises 206
Chapter Fourteen The C Preprocessor(C編譯預處理) 209
14.1 Including files(包含檔案) 209
14.2 Defining macros(定義宏) 210
14.3 Macro parameters(帶參數的宏) 211
14.4 Macros and functions(宏和函式) 213
14.5 Some useful macros(一些有用的宏) 214
14.6 Conditional directives(條件編譯預處理指令) 215
14.7 Character-testing macros(字元檢測宏) 216
Programming pitfalls 218
Quick syntax reference 218
Exercises 218
Appendix A List of C Keywords 220
Appendix B Precedence and Associativity of C Operators 221
Appendix C ASCII Character Codes 223
Appendix D Fundamental C Built-in Data Types 225