C Primer Plus, 4/e
暫譯: C 程式設計入門精要(第4版)

Stephen Prata

  • 出版商: SAMS
  • 出版日期: 2001-09-19
  • 售價: $1,029
  • 語言: 英文
  • 頁數: 970
  • 裝訂: Paperback
  • ISBN: 0672322226
  • ISBN-13: 9780672322228
  • 相關分類: C 程式語言
  • 已絕版

買這商品的人也買了...

商品描述

 

C Primer Plus is a conversational-style book aimed at those new to C programming. A friendly and easy-to-use self-study guide, this book will be appropriate for serious students of programming, as well as developers proficient in other languages with a desire to better understand the fundamentals of this core language.

As with all the editions, author Stephen Prata's aim has been to create an introduction to C that is instructive, clear, and helpful. Programming concepts are explained along with details of the C language; the book does not assume that you are a professional programmer. Many short, easily typed examples illustrate just one or two concepts at a time, since learning by doing is one of the most effective ways to master new information. Finally, review questions and programming exercises at the end of each chapter punctuate the most critical information and help readers digest the most difficult concepts. The text has been updated to accommodate the emergence of a new standard for C-C99.

Table of Contents

Preface.
1. Getting Ready.

Whence C? Why C? Whither C? High-Level Computer Languages and Compilers. Using C: Seven Steps. Programming Mechanics. Language Standards. Book Organization. Summary. Review Questions. Programming Exercise.


2. Introducing C.

A Simple Sample of C. The Explanation. The Structure of a Simple Program. Tips on Making Your Programs Readable. Taking Another Step. While You're at It ... Multiple Functions. Debugging. Keywords and Reserved Identifiers. Key Concepts. Summary. Review Questions. Programming Exercises.


3. Data and C.

A Sample Program. Data Variables and Constants. Data: Data-Type Keywords. C Data Types. Using Data Types. Arguments and Pitfalls. One More Example. Key Concepts. Summary. Review Questions. Programming Exercises.


4. Character Strings and Formatted Input/Output.

Introductory Program. Character Strings: An Introduction. Constants and the C Preprocessor. Exploring and Exploiting printf()and scanf(). Usage Tips. Key Concepts. Summary. Review Questions. Programming Exercises.


5. Operators, Expressions and Statements.

Introducing Loops. Fundamental Operators. Some Additional Operators. Expressions and Statements. Type Conversions. Function with Arguments. A Sample Program. Key Concepts. Summary. Review Questions. Programming Exercises.


6. C Control Statements: Looping.

An Initial Example. The while Statement. Which is Bigger: Using Relational Operators and Expressions. In Definite Loops and Counting Loops. The for Loop. More Assignment Operators. The Comma Operator. An Exit-Condition Loop: do while. Which Loop? Nested Loops. Arrays. A Loop Example Using a Function. Key Concepts. Summary. Review Questions. Programming Exercises.


7. C Control Statements: Branching and Jumps.

The If Statement. Adding else to the If Statement. Let's Get Logical. A Word-Count Program. The Conditional Operator: ?. Loop Aids: continue and break. Multiple Choice: switch and break. The goto. Statement. Key Concepts. Summary. Review Questions. Programming Exercises.


8. Character Input/Output and Redirection.

Single-Character I/O: getchar() and the putchar(). Buffers. Terminating Keyboard Input. Redirection and Files. Creating a Friendlier User Interface. Input Validation. Menu Browsing. Key Concepts. Summary. Review Questions. Programming Exercises.


9. Functions.

Reviewing Functions. ANSI C Function Prototyping. Recursion. All C Functions Are Created Equal. Compiling Programs. With Two or more Source Code Files. Finding Addresses: The & Operator. Altering Variables in the Calling Function. Pointers: A First Look. Key concepts. Summary. Review Questions. Programming Exercises.


10. Arrays and Pointers.

Arrays. Multidimensional Arrays. Pointers and Arrays. Pointers and Arrays. Functions, Arrays, and Pointers. Pointer Operations. Protecting Array Contents. Pointers and Multidimensional Arrays. Variable-Length Arrays (VLAs). Compund Literals. Key Concepts. Summary. Review Questions. Programming Exercises.


11. Character Strings and String Functions.

Defining Strings Within a Program. Character String Arrays and Initialization. String Input. String Output. The Do-It-Yourself Option. String Functions. A String Example: Sorting Strings. The ctype.h Character Functions and Strings. Command-Line Arguments. String to Number Conversions. Key Concepts. Summary. Review Questions. Programming Exercises.


12. Storage Classes, Linkage and Memory Management.

Storage Classes. A Random Number Function and a Static Variable. Roll'Em. ANSI C Type Qualifiers. New Places for Old Keywords. Key Concepts. Summary. Review Questions. Programming Exercises.


13. File Input/Output.

Communicating with Files. Standard I/O. A Simple-Minded File Condensing Program. File I/O: fprint(), fscan(), fgets(), and fputs(). Adventures in Random Access: fseek() and ftell(). Behind the Scenes with Standard I/O. Other Standard I/O Functions. Key Concepts. Summary. Review Questions. Programming Exercises.


14. Structures and Other Data Forms.

Sample Problem: Creating an Inventory of Books. Setting Up the Structure Declaration. Defining a Structure Variable. Gaining Access to Structure Members. Arrays of Structures. Nested Structures. Pointers to Structures. Telling Functions About Structures. Saving the Structure Contents in a File. Structures: What Next? Unions: A Quick Look. Enumerated Types. Typedef: A Quick Look. Fancy Declarations. Functions and Pointers. Key Concepts. Summary. Review Questions. Programming Exercises.


15. Bit Fiddling.

Binary Numbers. Bits, and Bytes. Other Bases. C's Bitwise Operators. Bit Fields. Key Concepts. Summary. Review Questions. Programming Exercises.


16. The C Preprocessor and the C Library.

First Steps. Manifest Constants: # define. Using Arguments with #define. Macro or Function? File Inclusion: #include. Other Directives. Inline Functions. The C Library. The Math Library. The General Utilities Library. The Assert Library. Memcpy() and memmove() from the string.h Library. Variable Arguments: stdarg.h. Key Concepts. Summary. Review Questions. Programming Exercises.


17. Advanced Data Representation.

Exploring Data Representation. Beyond the Array to the Linked List. Abstract Data Types (ADTs). Getting Queued with an ADT. Simulating with a Queue. The lInked List Versus with Array. Binary Search Trees. Other Directions. Key Concepts. Summary. Review Questions. Programming Exercises.


Appendix A: Reference Section.

Chapter 1. Chapter 2. Chapter 3. Chapter 4. Chapter 5. Chapter 6. Chapter 7. Chapter 8. Chapter 9. Chapter 10. Chapter 11. Chapter 12. Chapter 13. Chapter 14. Chapter 15. Chapter 16. Chapter 17.


Appendix B: Answers to the Review Questions.

Section I-Additional Reading. Section II-C Operators. Logical Operators. Sign Operators. Section III-Basic Types and Storage Classes. Summary: Qualifiers. Section IV-Expressions, Statements, and Program Flow. Section V-The Standard ANSI C Library with C99 Additions. Math Library: math.h. Variable Arguments: stdarg.h. Standard I/O Library: stdio.h. General Utilities: stdlib.h. Section VI-Extended Integer Types. Section VII-Expanded Character support. Section VIII-C99 Numeric Computatioal Enhancements. Section IX-Differences Between C and C++.


INDEX

商品描述(中文翻譯)

《C Primer Plus》是一本以對話風格撰寫的書籍,旨在幫助初學者學習 C 語言。這本友好且易於使用的自學指南,適合認真學習程式設計的學生,以及希望更好理解這一核心語言基礎的其他語言熟練開發者。

與所有版本一樣,作者 Stephen Prata 的目標是創造一本既具教育意義又清晰易懂的 C 語言入門書。程式設計概念與 C 語言的細節一同解釋;本書不假設讀者是專業程式設計師。許多簡短且易於輸入的範例一次只說明一到兩個概念,因為透過實作學習是掌握新資訊的最有效方式之一。最後,每章結尾的複習問題和程式設計練習強調了最關鍵的資訊,幫助讀者消化最困難的概念。文本已更新以適應 C 語言的新標準 C99 的出現。

目錄
前言。
1. 準備工作。
從何而來的 C?為什麼是 C?C 的未來?高階電腦語言與編譯器。使用 C:七個步驟。程式設計機制。語言標準。書籍組織。摘要。複習問題。程式設計練習。

2. 介紹 C。
C 的簡單範例。解釋。簡單程式的結構。使程式可讀的提示。再進一步。當你在做的時候……多個函數。除錯。關鍵字和保留識別符。關鍵概念。摘要。複習問題。程式設計練習。

3. 數據與 C。
範例程式。數據變數和常數。數據:數據類型關鍵字。C 數據類型。使用數據類型。參數和陷阱。再一個範例。關鍵概念。摘要。複習問題。程式設計練習。

4. 字符串和格式化輸入/輸出。
入門程式。字符字符串:介紹。常數和 C 預處理器。探索和利用 printf() 和 scanf()。使用提示。關鍵概念。摘要。複習問題。程式設計練習。

5. 運算符、表達式和語句。
介紹循環。基本運算符。一些附加運算符。表達式和語句。類型轉換。帶參數的函數。範例程式。關鍵概念。摘要。複習問題。程式設計練習。

6. C 控制語句:循環。
初始範例。while 語句。哪個更大:使用關係運算符和表達式。在確定循環和計數循環中。for 循環。更多賦值運算符。逗號運算符。退出條件循環:do while。哪個循環?嵌套循環。數組。使用函數的循環範例。關鍵概念。摘要。複習問題。程式設計練習。

7. C 控制語句:分支和跳轉。
if 語句。向 if 語句添加 else。讓我們邏輯思考。一個字數計算程式。條件運算符:?。循環輔助:continue 和 break。多選:switch 和 break。goto 語句。關鍵概念。摘要。複習問題。程式設計練習。

8. 字符輸入/輸出和重定向。
單字符 I/O:getchar() 和 putchar()。緩衝區。終止鍵盤輸入。重定向和文件。創建更友好的用戶界面。輸入驗證。菜單瀏覽。關鍵概念。摘要。複習問題。程式設計練習。

9. 函數。
回顧函數。ANSI C 函數原型。遞歸。所有 C 函數都是平等的。編譯程式。使用兩個或更多源代碼文件。查找地址:& 運算符。在調用函數中更改變數。指針:初步了解。關鍵概念。摘要。複習問題。程式設計練習。

10. 數組和指針。
數組。多維數組。指針和數組。指針和數組。函數、數組和指針。指針操作。保護數組內容。指針和多維數組。可變長度數組(VLA)。複合字面量。關鍵概念。摘要。複習問題。程式設計練習。

11. 字符串和字符串函數。
在程式中定義字符串。字符字符串數組和初始化。字符串輸入。字符串輸出。自助選項。字符串函數。一個字符串範例:排序字符串。ctype.h 字符函數和字符串。命令行參數。字符串到數字的轉換。關鍵概念。摘要。複習問題。程式設計練習。

12. 儲存類別、鏈接和內存管理。
儲存類別。一個隨機數函數和一個靜態變數。Roll'Em。ANSI C 類型限定符。舊關鍵字的新位置。關鍵概念。摘要。複習問題。程式設計練習。

13. 文件輸入/輸出。
與文件通信。標準 I/O。一個簡單的文件壓縮程式。文件 I/O:fprint()、fscan()、fgets() 和 fputs()。隨機訪問的冒險:fseek() 和 ftell()。標準 I/O 的幕後。其他標準 I/O 函數。關鍵概念。摘要。複習問題。程式設計練習。

14. 結構和其他數據形式。
範例問題:創建一本書的清單。設置結構聲明。定義結構變數。訪問結構成員。結構數組。嵌套結構。指向結構的指針。告訴函數有關結構的資訊。將結構內容保存到文件中。結構:接下來是什麼?聯合:快速了解。列舉類型。typedef:快速了解。複雜的聲明。函數和指針。關鍵概念。摘要。複習問題。程式設計練習。

15. 位操作。
二進制數字。位和字節。其他進制。C 的位運算符。位域。關鍵概念。摘要。複習問題。程式設計練習。

16. C 預處理器和 C 函式庫。
第一步。顯示常數:#define。使用 #define 的參數。宏還是函數?文件包含:#include。其他指令。內聯函數。C 函式庫。數學函式庫。通用工具函式庫。斷言函式庫。來自 string.h 函式庫的 memcpy() 和 memmove()。可變參數:stdarg.h。關鍵概念。摘要。複習問題。程式設計練習。

17. 進階數據表示。
探索數據表示。從數組到鏈表。抽象數據類型(ADT)。使用 ADT 進行排隊。使用隊列進行模擬。鏈表與數組的比較。二叉搜索樹。其他方向。關鍵概念。摘要。複習問題。程式設計練習。

附錄 A:參考部分。
第 1 章。第 2 章。第 3 章。第 4 章。第 5 章。第 6 章。第 7 章。第 8 章。第 9 章。第 10 章。第 11 章。第 12 章。第 13 章。第 14 章。第 15 章。第 16 章。第 17 章。

附錄 B:複習問題的答案。
第一部分-附加閱讀。第二部分-C 運算符。邏輯運算符。符號運算符。第三部分-基本類型和儲存類別。摘要:限定符。第四部分-表達式、語句和程式流程。第五部分-標準 ANSI C 函式庫及 C99 附加內容。數學函式庫:math.h。可變參數:stdarg.h。標準 I/O 函式庫:stdio.h。通用工具:stdlib.h。第六部分-擴展整數類型。第七部分-擴展字符支持。第八部分-C99 數值計算增強。第九部分-C 與 C++ 的差異。

索引