>> SPEAKER: Let's write a program that tries to copy two strings.
I've already gotten started by first printing out "Say something." I next
call GetString, storing the return value in s.
And then I make sure that s is not null.
>> Let's next make our copy of S. I'm going to declare a new variable, t,
and store in it s.
I'm next going to claim, with printf, that I'm going to
capitalize that copy.
I'm next going to check that t is at least greater than 0 in length so that
I don't accidentally try to capitalize a letter that's not there.
Once I'm sure, I'm going to change the value at t bracket 0 to be the return
value of toupper, a function that converts its input to uppercase,
passing in as its input t bracket 0.
>> Lastly, I'm going to print out what the original value was, which, of
course, was s.
And then I'm going to print what the value of the copy is, which is t.
>> When I now compile and run this program, I hope to see my original
input followed by a copy thereof with only the copy capitalized.
But let's check.
Make copy 0, ./ copy 0.
And I'll provide an input of, say, hello, but in all lowercase,
and then hit Enter.
>> Unfortunately, it seems that both the original and the copy are now "Hello"
with a capital H. But that's clearly not what I typed.
So apparently, when I capitalized t, I somehow capitalized s, even though I
thought I was making a copy of s and calling it t.
Surely, something here is wrong.
But how can we fix?