Most computer programs, at some point in their lives, have to communicate with a human being. The standard way to do this is to use text strings; that’s especially true for the console-based applications in this book.
Using text strings to print simple messages is easy enough. Text strings get more interesting when you pick apart, combine, or analyze them. That’s what this chapter is all about.
In Chapter 1, I said the computer stores text numerically, just like any other kind of data. But with text data, each byte uses a special code that corresponds to a particular character: This is called ASCII code. Suppose I declared the following string:
char *str = "Hello!";
C++ allocates exactly ...