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’ll learn:

• To create and use structs and to understand their near equivalence with classes.

• To use typedef to create aliases for data types.

• 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 ...

Get C++ How to Program, Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.