8.10. Pointer-Based Strings
We’ve already used the C++ Standard Library
string class to represent strings as full-fledged objects. For example, the
GradeBook class case study in Chapters 3–7 represents a course name using a
string object. Chapter 19 presents class
string in detail. This section introduces C-style, pointer-based strings (as defined by the C programming language), which we’ll simply call C strings. C++’s string class is preferred for use in new programs, because it eliminates many of the security problems and bugs that can be caused by manipulating C strings. We cover C strings here for a deeper understanding of pointers and built-in arrays. Also, if you work with legacy C and C++ programs, you’re likely to encounter pointer-based ...