logo资料库

Practical C Programming(3rd) 无水印pdf.pdf

第1页 / 共504页
第2页 / 共504页
第3页 / 共504页
第4页 / 共504页
第5页 / 共504页
第6页 / 共504页
第7页 / 共504页
第8页 / 共504页
资料共504页,剩余部分请下载后查看
Cover
Table of Contents
Preface
I. Basics
1. What Is C?
1.1 How Programming Works
1.2 Brief History of C
1.3 How C Works
1.4 How to Learn C
2. Basics of Program Writing
2.1 Programs from Conception to Execution
2.2 Creating a Real Program
2.3 Creating a Program Using a Command-Line Compiler
2.4 Creating a Program Using an Integrated Development Environment
2.5 Getting Help on UNIX
2.6 Getting Help in an Integrated Development Environment
2.7 IDE Cookbooks
2.8 Programming Exercises
3. Style
3.1 Common Coding Practices
3.2 Coding Religion
3.3 Indentation and Code Format
3.4 Clarity
3.5 Simplicity
3.6 Summary
4. Basic Declarations and Expressions
4.1 Elements of a Program
4.2 Basic Program Structure
4.3 Simple Expressions
4.4 Variables and Storage
4.5 Variable Declarations
4.6 Integers
4.7 Assignment Statements
4.8 printf Function
4.9 Floating Point
4.10 Floating Point Versus Integer Divide
4.11 Characters
4.12 Answers
4.13 Programming Exercises
5. Arrays, Qualifiers, and Reading Numbers
5.1 Arrays
5.2 Strings
5.3 Reading Strings
5.4 Multidimensional Arrays
5.5 Reading Numbers
5.6 Initializing Variables
5.7 Types of Integers
5.8 Types of Floats
5.9 Constant Declarations
5.10 Hexadecimal and Octal Constants
5.11 Operators for Performing Shortcuts
5.12 Side Effects
5.13 ++x or x++
5.14 More Side-Effect Problems
5.15 Answers
5.16 Programming Exercises
6. Decision and Control Statements
6.1 if Statement
6.2 else Statement
6.3 How Not to Use strcmp
6.4 Looping Statements
6.5 while Statement
6.6 break Statement
6.7 continue Statement
6.8 Assignment Anywhere Side Effect
6.9 Answer
6.10 Programming Exercises
7. Programming Process
7.1 Setting Up
7.2 Specification
7.3 Code Design
7.4 Prototype
7.5 Makefile
7.6 Testing
7.7 Debugging
7.8 Maintenance
7.9 Revisions
7.10 Electronic Archaeology
7.11 Marking Up the Program
7.12 Using the Debugger
7.13 Text Editor as a Browser
7.14 Add Comments
7.15 Programming Exercises
II. Simple Programming
8. More Control Statements
8.1 for Statement
8.2 switch Statement
8.3 switch, break, and continue
8.4 Answers
8.5 Programming Exercises
9. Variable Scope and Functions
9.1 Scope and Class
9.2 Functions
9.3 Functions with No Parameters
9.4 Structured Programming
9.5 Recursion
9.6 Answers
9.7 Programming Exercises
10. C Preprocessor
10.1 #define Statement
10.2 Conditional Compilation
10.3 include Files
10.4 Parameterized Macros
10.5 Advanced Features
10.6 Summary
10.7 Answers
10.8 Programming Exercises
11. Bit Operations
11.1 Bit Operators
11.2 The and Operator (&)
11.3 Bitwise or (|)
11.4 The Bitwise Exclusive or (^)
11.5 The Ones Complement Operator (Not) (~)
11.6 The Left- and Right-Shift Operators (<<, >>)
11.7 Setting, Clearing, and Testing Bits
11.8 Bitmapped Graphics
11.9 Answers
11.10 Programming Exercises
12. Advanced Types
12.1 Structures
12.2 Unions
12.3 typedef
12.4 enum Type
12.5 Casting
12.6 Bit Fields or Packed Structures
12.7 Arrays of Structures
12.8 Summary
12.9 Programming Exercises
13. Simple Pointers
13.1 Pointers as Function Arguments
13.2 const Pointers
13.3 Pointers and Arrays
13.4 How Not to Use Pointers
13.5 Using Pointers to Split a String
13.6 Pointers and Structures
13.7 Command-Line Arguments
13.8 Programming Exercises
13.9 Answers
14. File Input/Output
14.1 Conversion Routines
14.2 Binary and ASCII Files
14.3 The End-of-Line Puzzle
14.4 Binary I/O
14.5 Buffering Problems
14.6 Unbuffered I/O
14.7 Designing File Formats
14.8 Answers
14.9 Programming Exercises
15. Debugging and Optimization
15.1 Debugging
15.2 Interactive Debuggers
15.3 Debugging a Binary Search
15.4 Runtime Errors
15.5 The Confessional Method of Debugging
15.6 Optimization
15.7 Answers
15.8 Programming Exercises
16. Floating Point
16.1 Floating-Point Format
16.2 Floating Addition/Subtraction
16.3 Multiplication
16.4 Division
16.5 Overflow and Underflow
16.6 Roundoff Error
16.7 Accuracy
16.8 Minimizing Roundoff Error
16.9 Determining Accuracy
16.10 Precision and Speed
16.11 Power Series
16.12 Programming Exercises
III. Advanced Programming Concepts
17. Advanced Pointers
17.1 Pointers and Structures
17.2 free Function
17.3 Linked List
17.4 Structure Pointer Operator
17.5 Ordered Linked Lists
17.6 Double-Linked Lists
17.7 Trees
17.8 Printing a Tree
17.9 Rest of Program
17.10 Data Structures for a Chess Program
17.11 Answers
17.12 Programming Exercises
18. Modular Programming
18.1 Modules
18.2 Public and Private
18.3 The extern Modifier
18.4 Headers
18.5 The Body of the Module
18.6 A Program to Use Infinite Arrays
18.7 The Makefile for Multiple Files
18.8 Using the Infinite Array
18.9 Dividing a Task into Modules
18.10 Module Division Example: Text Editor
18.11 Compiler
18.12 Spreadsheet
18.13 Module Design Guidelines
18.14 Programming Exercises
19. Ancient Compilers
19.1 K&R-Style Functions
19.2 Library Changes
19.3 Missing Features
19.4 Free/Malloc Changes
19.5 lint
19.6 Answers
20. Portability Problems
20.1 Modularity
20.2 Word Size
20.3 Byte Order Problem
20.4 Alignment Problem
20.5 NULL Pointer Problem
20.6 Filename Problems
20.7 File Types
20.8 Summary
20.9 Answers
21. C's Dustier Corners
21.1 do/while
21.2 goto
21.3 The ?: Construct
21.4 The , Operator
21.5 volatile Qualifier
21.6 Answer
22. Putting It All Together
22.1 Requirements
22.2 Specification
22.3 Code Design
22.4 Coding
22.5 Functional Description
22.6 Expandability
22.7 Testing
22.8 Revisions
22.9 A Final Warning
22.10 Program Files
22.11 Programming Exercises
23. Programming Adages
23.1 General
23.2 Design
23.3 Declarations
23.4 switch Statement
23.5 Preprocessor
23.6 Style
23.7 Compiling
23.8 Final Note
23.9 Answer
IV. Other Language Features
A. ASCII Table
B. Ranges and Parameter Passing Conversions
C. Operator Precedence Rules
D. A Program to Compute a Sine Using a Power Series
Glossary
Practical C Programming, 3rd Edition By Steve Oualline 3rd Edition August 1997 ISBN: 1-56592-306-5 This new edition of "Practical C Programming" teaches users not only the mechanics or programming, but also how to create programs that are easy to read, maintain, and debug. It features more extensive examples and an introduction to graphical development environments. Programs conform to ANSI C. 0 TEAM FLY PRESENTS
Table of Contents Preface How This Book is Organized Chapter by Chapter Notes on the Third Edition Font Conventions Obtaining Source Code Comments and Questions Acknowledgments Acknowledgments to the Third Edition I. Basics 1. What Is C? How Programming Works Brief History of C How C Works How to Learn C 2. Basics of Program Writing Programs from Conception to Execution Creating a Real Program Creating a Program Using a Command-Line Compiler Creating a Program Using an Integrated Development Environment Getting Help on UNIX Getting Help in an Integrated Development Environment IDE Cookbooks Programming Exercises 3. Style Common Coding Practices Coding Religion Indentation and Code Format Clarity Simplicity Summary 4. Basic Declarations and Expressions Elements of a Program Basic Program Structure Simple Expressions Variables and Storage 1 TEAM FLY PRESENTS
Variable Declarations Integers Assignment Statements printf Function Floating Point Floating Point Versus Integer Divide Characters Answers Programming Exercises 5. Arrays, Qualifiers, and Reading Numbers Arrays Strings Reading Strings Multidimensional Arrays Reading Numbers Initializing Variables Types of Integers Types of Floats Constant Declarations Hexadecimal and Octal Constants Operators for Performing Shortcuts Side Effects ++x or x++ More Side-Effect Problems Answers Programming Exercises 6. Decision and Control Statements if Statement else Statement How Not to Use strcmp Looping Statements while Statement break Statement continue Statement Assignment Anywhere Side Effect Answer Programming Exercises 7. Programming Process Setting Up Specification 2 TEAM FLY PRESENTS
Code Design Prototype Makefile Testing Debugging Maintenance Revisions Electronic Archaeology Marking Up the Program Using the Debugger Text Editor as a Browser Add Comments Programming Exercises II. Simple Programming 8. More Control Statements for Statement switch Statement switch, break, and continue Answers Programming Exercises 9. Variable Scope and Functions Scope and Class Functions Functions with No Parameters Structured Programming Recursion Answers Programming Exercises 10. C Preprocessor #define Statement Conditional Compilation include Files Parameterized Macros Advanced Features Summary Answers Programming Exercises 11. Bit Operations Bit Operators The and Operator (&) 3 TEAM FLY PRESENTS
Bitwise or (|) The Bitwise Exclusive or (^) The Ones Complement Operator (Not) (~) The Left- and Right-Shift Operators (<<, >>) Setting, Clearing, and Testing Bits Bitmapped Graphics Answers Programming Exercises 12. Advanced Types Structures Unions typedef enum Type Casting Bit Fields or Packed Structures Arrays of Structures Summary Programming Exercises 13. Simple Pointers Pointers as Function Arguments const Pointers Pointers and Arrays How Not to Use Pointers Using Pointers to Split a String Pointers and Structures Command-Line Arguments Programming Exercises Answers 14. File Input/Output Conversion Routines Binary and ASCII Files The End-of-Line Puzzle Binary I/O Buffering Problems Unbuffered I/O Designing File Formats Answers Programming Exercises 15. Debugging and Optimization Debugging Interactive Debuggers 4 TEAM FLY PRESENTS
Debugging a Binary Search Runtime Errors The Confessional Method of Debugging Optimization Answers Programming Exercises 16. Floating Point Floating-Point Format Floating Addition/Subtraction Multiplication Division Overflow and Underflow Roundoff Error Accuracy Minimizing Roundoff Error Determining Accuracy Precision and Speed Power Series Programming Exercises III. Advanced Programming Concepts 17. Advanced Pointers Pointers and Structures free Function Linked List Structure Pointer Operator Ordered Linked Lists Double-Linked Lists Trees Printing a Tree Rest of Program Data Structures for a Chess Program Answers Programming Exercises 18. Modular Programming Modules Public and Private The extern Modifier Headers The Body of the Module A Program to Use Infinite Arrays 5 TEAM FLY PRESENTS
The Makefile for Multiple Files Using the Infinite Array Dividing a Task into Modules Module Division Example: Text Editor Compiler Spreadsheet Module Design Guidelines Programming Exercises 19. Ancient Compilers K&R-Style Functions Library Changes Missing Features Free/Malloc Changes lint Answers 20. Portability Problems Modularity Word Size Byte Order Problem Alignment Problem NULL Pointer Problem Filename Problems File Types Summary Answers 21. C's Dustier Corners do/while goto The ?: Construct The , Operator volatile Qualifier Answer 22. Putting It All Together Requirements Specification Code Design Coding Functional Description 6 TEAM FLY PRESENTS
Expandability Testing Revisions A Final Warning Program Files Programming Exercises 23. Programming Adages General Design Declarations switch Statement Preprocessor Style Compiling Final Note Answer IV. Other Language Features A. ASCII Table B. Ranges and Parameter Passing Conversions C. Operator Precedence Rules D. A Program to Compute a Sine Using a Power Series Glossary Index 7 TEAM FLY PRESENTS
分享到:
收藏