August 2002
Beginner
1122 pages
22h 1m
English
Although it's actually possible to get the effect of two independent strings without the extra work of allocating memory and copying data every time an assignment is done, the mechanisms needed to do that are beyond the scope of this book.[11] By far the easiest way to have the effect of two independent strings is to actually make another copy of a string's data whenever we copy the string, and that's how we'll do it here. The results will be as indicated in Figure 7.12.
[11] We'll see how to implement a similar feature in another context when we get back to the discussion of inventory control later.
With this arrangement, a change to one of the string ...
Read now
Unlock full access