October 2011
Beginner to intermediate
1200 pages
35h 33m
English
The string class makes some operations simpler than is the case for arrays. For example, you can’t simply assign one array to another. But you can assign one string object to another:
char charr1[20]; // create an empty arraychar charr2[20] = "jaguar"; // create an initialized arraystring str1; // create an empty string objectstring str2 = "panther"; // create an initialized stringcharr1 = charr2; // INVALID, no array assignmentstr1 = str2; // VALID, object assignment ok
The string class simplifies combining strings. You can use the + operator to add two string objects together and the += operator to tack on a string to the end of an existing string ...
Read now
Unlock full access