19. Bits, Characters, C Strings and
structs
Objectives |
|
In this chapter you'll learn:
-
To create and use structs.
-
To pass structs to functions
by value and by reference.
-
To use typedef to create
aliases for previously defined data types and structs.
-
To manipulate data with the bitwise
operators and to create bit fields for storing data compactly.
-
To use the functions of the character-handling library
<cctype>.
-
To use the string-conversion functions of the general-utilities
library <cstdlib>.
-
To use the string-processing functions of the string-handling
library <cstring>. |
The
same old charitable lie Repeated as the years scoot by Perpetually makes a
hit—"You really haven't changed a bit!"
—Margaret
Fishback
The
chief defect of Henry King Was chewing little bits of string.
—Hilaire
Belloc
Vigorous writing is concise. A sentence should
contain no unnecessary words, a paragraph no unnecessary sentences.
—William Strunk,
Jr.
Outline |
|
| 19.1 |
Introduction |
| 19.2 |
Structure Definitions |
| 19.3 |
Initializing Structures |
| 19.4 |
Using Structures with
Functions |
| 19.5 |
typedef |
| 19.6 |
Example: High-Performance Card
Shuffling and Dealing Simulation |
| 19.7 |
Bitwise Operators |
| 19.8 |
Bit Fields |
| 19.9 |
Character-Handling
Library |
| 19.10 |
Pointer-Based String-Conversion
Functions |
| 19.11 |
Search Functions of the
Pointer-Based String-Handling Library |
| 19.12 |
Memory Functions of the
Pointer-Based String-Handling Library |
| 19.13 |
Wrap-Up |
|