Chapter 16

Arrays with Character

In This Chapter

arrow Introducing the null-terminated character array

arrow Creating an ASCIIZ array variable

arrow Examining two example ASCIIZ manipulation programs

arrow Reviewing some of the most common built-in ASCIIZ library functions

In Chapter 15, which introduces the concept of arrays, the example program collects values into an integer array, which is then passed to a function to display and to a separate function to average. However, as useful as an array of integers might be, far and away the most common type of array is the character array. Specifically something known as the ASCIIZ character array, which is the subject of this chapter.

The ASCII-Zero Character Array

Arrays have an inherent problem: You can never know, just by looking at the array, how many values are actually stored in it. Knowing the size of an array is not enough. That tells you how many values the array can hold, not how many it actually does hold. The difference is like the difference between how much gas your car’s tank can hold and how much gas it actually has. Even if your tank holds ...

Get Beginning Programming with C++ For Dummies, 2nd 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.