8. Pointers and Pointer-Based
Strings
Objectives |
|
In this chapter you'll learn:
-
What pointers are.
-
The similarities and
differences between pointers and references, and when to use each.
-
To use pointers to pass arguments to
functions by reference.
-
To use pointer-based C-style strings.
-
The close relationships among
pointers, arrays and C-style strings.
-
To use pointers to
functions.
-
To declare and use arrays of C-style
strings. |
Addresses are given to us to
conceal our whereabouts.
—Saki (H. H.
Munro)
By indirection find direction
out.
—William
Shakespeare
Many things, having full
reference To one consent, may work contrariously.
—William
Shakespeare
You
will find it a very good practice always to verify your references,
sir!
—Dr. Routh
Outline |
|
| 8.1 |
Introduction |
| 8.2 |
Pointer Variable
Declarations and Initialization |
| 8.3 |
Pointer
Operators |
| 8.4 |
Passing Arguments to
Functions by Reference with Pointers |
| 8.5 |
Using const with
Pointers |
| 8.6 |
Selection Sort Using
Pass-by-Reference |
| 8.7 |
sizeof
Operator |
| 8.8 |
Pointer Expressions and
Pointer Arithmetic |
| 8.9 |
Relationship Between
Pointers and Arrays |
| 8.10 |
Arrays of
Pointers |
| 8.11 |
Case Study: Card
Shuffling and Dealing Simulation |
| 8.12 |
Function
Pointers |
| 8.13 |
Introduction to
Pointer-Based String Processing |
| |
8.13.1 |
Fundamentals of Characters and
Pointer-Based Strings |
| |
8.13.2 |
String-Manipulation Functions of
the String-Handling Library |
| 8.14 |
Wrap-Up |
|