Playing out the string

Susan had some questions about these objectives. Here's the discussion.

Susan: What is the difference between literal C strings and variables of the string class?

Steve: A variable of the string class is what you've been using to store variable-length alphanumeric data. You can copy them, input them from the keyboard, assign values to them, and the like. By contrast, a literal C string is just a bunch of characters in a row; all you can do with it is display it or assign it to a string variable.

Susan: Okay, then you are saying that variables of the string class are what I am used to working with, but I just didn't know that they were part of a class because you were keeping this all a big secret. On the other hand, a literal ...

Get Learning to Program in C++ 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.