I l @ ve RuBoard |
C Primer Plus , Third Edition
Preface
Preface to the Third Edition
Preface to the Second Edition
Preface to the First Edition
About the Author
Acknowledgments
Acknowledgments for the Third Edition
Acknowledgments for the Second Edition
Acknowledgments for the First Edition
Tell Us What You Think!
1. GETTING READY
Whence C?
Why C?
Whither C?
Using C: Seven Steps
Programming Mechanics
Language Standards
Some Conventions
Chapter 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 Multiple Functions
While You're at It Multiple Functions
Keywords
Chapter 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
Chapter 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
Chapter 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
Chapter Summary
Review Questions
Programming Exercises
6. C CONTROL STATEMENTS: LOOPING
An Initial Example
The while Statement
Which Is Bigger: Using Relational Operators and Expressions
Indefinite 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 Return Value
Chapter 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
Chapter Summary
Review Questions
Programming Exercises
8. CHARACTER INPUT/OUTPUT AND REDIRECTION
Single-Character I/O: getchar () and putchar ()
Buffers
Terminating Keyboard Input
Redirection and Files
A Graphic Example
Creating a Friendlier User Interface
Character Sketches
Menu Browsing
Chapter Summary
Review Questions
Programming Exercises
9. FUNCTIONS
Review
ANSI C Function Prototyping
Recursion
All C Functions Are Created Equal
Compiling Programs with Two or More Functions
Finding Addresses: The & Operator
Altering Variables in the Calling Function
Pointers: A First Look
Chapter Summary
Review Questions
Programming Exercises
10. ARRAYS AND POINTERS
Arrays
Pointers to Arrays
Functions, Arrays, and Pointers
Pointer Operations
Protecting Array Contents
Multidimensional Arrays
Pointers and Multidimensional Arrays
Planning a Program
Chapter 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
Chapter Summary
Review Questions
Programming Exercises
12. FILE INPUT/OUTPUT
Communicating with Files
Standard I/O
A Simple-Minded File-Condensing Program
File I/O: fprintf() , fscanf() , fgets() , and fputs()
Adventures in Random Access: fseek() and ftell ()
Behind the Scenes with Standard I/O
Other Standard I/O Functions
Chapter Summary
Review Questions
Programming Exercises
13. STORAGE CLASSES AND PROGRAM DEVELOPMENT
Storage Classes and Scope
A Random Number Function
Roll 'Em
Sorting Numbers
ANSI C Type Qualifiers
Chapter 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
typedef : A Quick Look
Fancy Declarations
Functions and Pointers
Chapter Summary
Review Questions
Programming Exercises
15. BIT FIDDLING
Binary Numbers, Bits, and Bytes
Other Bases
C's Bitwise Operators
Bit Fields
Chapter Summary
Review Questions
Programming Exercises
16. THE C PREPROCESSOR AND THE C LIBRARY
Manifest Constants: #define
Using Arguments with #define
Macro or Function?
File Inclusion: #include
Other Directives
Enumerated Types
The C Library
The Math Library
The General Utilities Library
The Assert Library
Chapter 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 the Array
Binary Search Trees
Other Directions
Chapter Summary
Review Questions
Programming Exercises
A. ADDITIONAL READING
C Language
Programming
Reference
B. C OPERATORS
Arithmetic Operators
Relational Operators
Assignment Operators
Logical Operators
The Conditional Operator
Pointer-Related Operators
Sign Operators
Structure and Union Operators
Bitwise Operators
Miscellaneous Operators
C. BASIC TYPES AND STORAGE CLASSES
Summary: The Basic Data Types
Summary: How to Declare a Simple Variable
Summary: Qualifiers
D. EXPRESSIONS, STATEMENTS, AND PROGRAM FLOW
Summary: Expressions and Statements
Summary: The while Statement
Summary: The for Statement
Summary: The do while Statement
Summary: Using if Statements for Making Choices
Summary: Multiple Choice with switch
Summary: Program Jumps
E. THE ASCII CHARACTER SET
F. THE STANDARD ANSI C LIBRARY
Diagnostics: assert.h
Character Handling: ctype.h
Localization: locale.h
Math Library: math.h
Non-Local Jumps: setjmp.h
Signal Handling: signal.h
Variable Arguments: stdarg.h
Standard I/O Library: stdio.h
General Utilities: stdlib.h
String Handling: string.h
Date and Time: time.h
G. DIFFERENCES BETWEEN C AND C++
Declarations
Function Prototypes
Function Definitions
Comments
char Constants
The const Modifier
Structures and Unions
Enumerations
Pointer Type-Checking
H. THE C9X COMMITTEE
Types
Enhanced Computational Support
Wide Character Support
I. ANSWERS TO THE REVIEW QUESTIONS
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
I l @ ve RuBoard |