www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 1057]

Chapter 22. Bits, Characters, C-Strings and structs

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.

OBJECTIVES

In this chapter you will 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>.


[Page 1058]

Outline

22.1 Introduction

22.2 Structure Definitions

22.3 Initializing Structures

22.4 Using Structures with Functions

22.5 typedef

22.6 Example: High-Performance Card Shuffling and Dealing Simulation

22.7 Bitwise Operators

22.8 Bit Fields

22.9 Character-Handling Library

22.10 Pointer-Based String-Conversion Functions

22.11 Search Functions of the Pointer-Based String-Handling Library

22.12 Memory Functions of the Pointer-Based String-Handling Library

22.13 Wrap-Up

Summary

Terminology

Self-Review Exercises

Answers to Self-Review Exercises

Exercises


Previous Page
Next Page